⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269033 in webkit


Ignore:
Timestamp:
Oct 27, 2020, 6:00:41 AM (6 years ago)
Author:
calvaris@igalia.com
Message:

[EME][GStreamer] Decode base64 init data if needed
​https://bugs.webkit.org/show_bug.cgi?id=218175

Reviewed by Philippe Normand.

There are certain strings with certain key systems that deliver
initialization data encoded as base64 so we need to decode it
first.

  • platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:

(WebCore::InitData::InitData):
(WebCore::InitData::decodeBase64IfNeeded):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269032 r269033  
     12020-10-27  Xabier Rodriguez Calvar  <calvaris@igalia.com>
     2
     3        [EME][GStreamer] Decode base64 init data if needed
     4        https://bugs.webkit.org/show_bug.cgi?id=218175
     5
     6        Reviewed by Philippe Normand.
     7
     8        There are certain strings with certain key systems that deliver
     9        initialization data encoded as base64 so we need to decode it
     10        first.
     11
     12        * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
     13        (WebCore::InitData::InitData):
     14        (WebCore::InitData::decodeBase64IfNeeded):
     15
    1162020-10-15  Sergio Villar Senin  <svillar@igalia.com>
    217
  • trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h

    r269031 r269033  
    2727#include "SharedBuffer.h"
    2828#include <gst/gst.h>
     29#include <wtf/text/Base64.h>
    2930#include <wtf/text/WTFString.h>
    3031
    … …  
    5253        }
    5354        m_payload = mappedInitData->createSharedBuffer();
     55        decodeBase64IfNeeded();
    5456    }
    5557
    … …  
    5860        , m_payload(WTFMove(payload))
    5961    {
     62        decodeBase64IfNeeded();
    6063    }
    6164
    … …  
    7477
    7578        m_payload->append(*initData.payload());
     79    }
     80
     81    void decodeBase64IfNeeded()
     82    {
     83        GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload size %zu", m_payload->size());
     84        if (!m_payload->size())
     85            return;
     86
     87        Vector<char> out;
     88        if (!base64Decode(m_payload->data(), m_payload->size(), out)) {
     89            GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload did not decode base64, considering ok");
     90            return;
     91        }
     92
     93        GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload decoded to base64, new size %zu", out.size());
     94        m_payload = SharedBuffer::create(out.data(), out.size());
    7695    }
    7796
Note: See TracChangeset for help on using the changeset viewer.