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

Changeset 246441 in webkit


Ignore:
Timestamp:
Jun 14, 2019, 1:10:29 PM (7 years ago)
Author:
jer.noble@apple.com
Message:

REGRESSION(244439): platform/mac/media/encrypted-media/fps-* tests are crashing
https://bugs.webkit.org/show_bug.cgi?id=198612
<rdar://problem/51078978>

Reviewed by Eric Carlson.

There are two implementations of a 'cenc' initialiation data factory; an ASSERT fires when
the second one is added to the registry. Unify them.

  • Modules/encryptedmedia/InitDataRegistry.cpp:

(WebCore::extractKeyIDsCenc):

  • platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:

(WebCore::CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes):
(WebCore::CDMPrivateFairPlayStreaming::fairPlaySystemID):
(WebCore::validInitDataTypes):
(WebCore::CDMFactory::platformRegisterFactories):
(WebCore::validFairPlayStreamingSchemes): Deleted.
(WebCore::CDMPrivateFairPlayStreaming::cencName): Deleted.
(WebCore::fairPlaySystemID): Deleted.
(WebCore::extractSchemeAndKeyIdFromCenc): Deleted.
(WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsCenc): Deleted.
(WebCore::CDMPrivateFairPlayStreaming::sanitizeCenc): Deleted.

  • platform/graphics/avfoundation/CDMFairPlayStreaming.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246439 r246441  
     12019-06-14  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION(244439): platform/mac/media/encrypted-media/fps-* tests are crashing
     4        https://bugs.webkit.org/show_bug.cgi?id=198612
     5        <rdar://problem/51078978>
     6
     7        Reviewed by Eric Carlson.
     8
     9        There are two implementations of a 'cenc' initialiation data factory; an ASSERT fires when
     10        the second one is added to the registry. Unify them.
     11
     12        * Modules/encryptedmedia/InitDataRegistry.cpp:
     13        (WebCore::extractKeyIDsCenc):
     14        * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
     15        (WebCore::CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes):
     16        (WebCore::CDMPrivateFairPlayStreaming::fairPlaySystemID):
     17        (WebCore::validInitDataTypes):
     18        (WebCore::CDMFactory::platformRegisterFactories):
     19        (WebCore::validFairPlayStreamingSchemes): Deleted.
     20        (WebCore::CDMPrivateFairPlayStreaming::cencName): Deleted.
     21        (WebCore::fairPlaySystemID): Deleted.
     22        (WebCore::extractSchemeAndKeyIdFromCenc): Deleted.
     23        (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsCenc): Deleted.
     24        (WebCore::CDMPrivateFairPlayStreaming::sanitizeCenc): Deleted.
     25        * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
     26
    1272019-06-14  Saam Barati  <sbarati@apple.com>
    228
  • trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp

    r239427 r246441  
    3737#include <wtf/text/Base64.h>
    3838
     39#if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA)
     40#include "CDMFairPlayStreaming.h"
     41#include "ISOFairPlayStreamingPsshBox.h"
     42#endif
     43
    3944
    4045namespace WebCore {
     
    130135            return WTF::nullopt;
    131136
     137#if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA)
     138        if (psshBox.systemID() == CDMPrivateFairPlayStreaming::fairPlaySystemID()) {
     139            ISOFairPlayStreamingPsshBox fpsPssh;
     140            offset -= psshBox.size();
     141            if (!fpsPssh.read(view, offset))
     142                return WTF::nullopt;
     143
     144            FourCC scheme = fpsPssh.initDataBox().info().scheme();
     145            if (CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes().contains(scheme)) {
     146                for (auto request : fpsPssh.initDataBox().requests()) {
     147                    auto& keyID = request.requestInfo().keyID();
     148                    keyIDs.append(SharedBuffer::create(keyID.data(), keyID.size()));
     149                }
     150            }
     151        }
     152#endif
     153
    132154        for (auto& value : psshBox.keyIDs())
    133155            keyIDs.append(SharedBuffer::create(WTFMove(value)));
  • trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp

    r244439 r246441  
    3333#include "CDMRestrictions.h"
    3434#include "CDMSessionType.h"
    35 #include "ISOFairPlayStreamingPsshBox.h"
    3635#include "ISOSchemeInformationBox.h"
    3736#include "ISOSchemeTypeBox.h"
     
    5251namespace WebCore {
    5352
    54 static const Vector<FourCC>& validFairPlayStreamingSchemes()
    55 {
    56     static NeverDestroyed<Vector<FourCC>> validSchemes = Vector<FourCC>({ 
     53const Vector<FourCC>& CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes()
     54{
     55    static NeverDestroyed<Vector<FourCC>> validSchemes = Vector<FourCC>({
    5756        "cbcs",
    5857        "cbc2",
     
    7675}
    7776
    78 const AtomicString& CDMPrivateFairPlayStreaming::cencName()
    79 {
    80     static NeverDestroyed<AtomicString> cenc { MAKE_STATIC_STRING_IMPL("cenc") };
    81     return cenc;
    82 }
    83 
    84 static const Vector<uint8_t>& fairPlaySystemID()
     77const Vector<uint8_t>& CDMPrivateFairPlayStreaming::fairPlaySystemID()
    8578{
    8679    static NeverDestroyed<Vector<uint8_t>> systemID = Vector<uint8_t>({ 0x94, 0xCE, 0x86, 0xFB, 0x07, 0xFF, 0x4F, 0x43, 0xAD, 0xB8, 0x93, 0xD2, 0xFA, 0x96, 0x8C, 0xA2 });
     
    185178}
    186179
    187 static SchemeAndKeyResult extractSchemeAndKeyIdFromCenc(const SharedBuffer& buffer)
    188 {
    189     auto arrayBuffer = buffer.tryCreateArrayBuffer();
    190     if (!arrayBuffer)
    191         return { };
    192 
    193     auto view = JSC::DataView::create(WTFMove(arrayBuffer), 0, buffer.size());
    194     unsigned offset { 0 };
    195 
    196     SchemeAndKeyResult result;
    197     while (offset < buffer.size()) {
    198         auto peekResult = ISOBox::peekBox(view, offset);
    199         if (!peekResult || peekResult.value().first != ISOProtectionSystemSpecificHeaderBox::boxTypeName())
    200             return { };
    201 
    202         ISOProtectionSystemSpecificHeaderBox psshBox;
    203         if (!psshBox.read(view, offset))
    204             return { };
    205 
    206         if (psshBox.systemID() != fairPlaySystemID())
    207             continue;
    208 
    209         ISOFairPlayStreamingPsshBox fpsPssh;
    210         offset -= psshBox.size();
    211         if (!fpsPssh.read(view, offset))
    212             return { };
    213 
    214         FourCC scheme = fpsPssh.initDataBox().info().scheme();
    215         for (auto request : fpsPssh.initDataBox().requests())
    216             result.append(std::make_pair(scheme, request.requestInfo().keyID()));
    217     }
    218 
    219     return result;
    220 }
    221 
    222 Optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsCenc(const SharedBuffer& buffer)
    223 {
    224     Vector<Ref<SharedBuffer>> keyIDs;
    225     auto results = extractSchemeAndKeyIdFromCenc(buffer);
    226 
    227     for (auto& result : results) {
    228         if (validFairPlayStreamingSchemes().contains(result.first))
    229             keyIDs.append(SharedBuffer::create(result.second.data(), result.second.size()));
    230     }
    231 
    232     return keyIDs;
    233 }
    234 
    235180RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeSinf(const SharedBuffer& buffer)
    236181{
     
    248193}
    249194
    250 RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeCenc(const SharedBuffer& buffer)
    251 {
    252     UNUSED_PARAM(buffer);
    253     notImplemented();
    254     return buffer.copy();
    255 }
    256 
    257195Optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSkd(const SharedBuffer& buffer)
    258196{
     
    268206        CDMPrivateFairPlayStreaming::sinfName(),
    269207        CDMPrivateFairPlayStreaming::skdName(),
    270 #if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA)
    271         CDMPrivateFairPlayStreaming::cencName(),
    272 #endif
    273208    });
    274209    return validTypes;
     
    282217    InitDataRegistry::shared().registerInitDataType(CDMPrivateFairPlayStreaming::sinfName(), { CDMPrivateFairPlayStreaming::sanitizeSinf, CDMPrivateFairPlayStreaming::extractKeyIDsSinf });
    283218    InitDataRegistry::shared().registerInitDataType(CDMPrivateFairPlayStreaming::skdName(), { CDMPrivateFairPlayStreaming::sanitizeSkd, CDMPrivateFairPlayStreaming::extractKeyIDsSkd });
    284 #if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA)
    285     InitDataRegistry::shared().registerInitDataType(CDMPrivateFairPlayStreaming::cencName(), { CDMPrivateFairPlayStreaming::sanitizeCenc, CDMPrivateFairPlayStreaming::extractKeyIDsCenc });
    286 #endif
    287219}
    288220
  • trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h

    r244439 r246441  
    3232
    3333namespace WebCore {
     34
     35struct FourCC;
    3436
    3537class CDMFactoryFairPlayStreaming final : public CDMFactory {
     
    7678    static RefPtr<SharedBuffer> sanitizeSkd(const SharedBuffer&);
    7779
    78     static const AtomicString& cencName();
    79     static Optional<Vector<Ref<SharedBuffer>>> extractKeyIDsCenc(const SharedBuffer&);
    80     static RefPtr<SharedBuffer> sanitizeCenc(const SharedBuffer&);
     80    static const Vector<FourCC>& validFairPlayStreamingSchemes();
     81    static const Vector<uint8_t>& fairPlaySystemID();
    8182};
    8283
Note: See TracChangeset for help on using the changeset viewer.