Changeset 246441 in webkit
- Timestamp:
- Jun 14, 2019, 1:10:29 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Modules/encryptedmedia/InitDataRegistry.cpp (modified) (2 diffs)
-
platform/graphics/avfoundation/CDMFairPlayStreaming.cpp (modified) (7 diffs)
-
platform/graphics/avfoundation/CDMFairPlayStreaming.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246439 r246441 1 2019-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 1 27 2019-06-14 Saam Barati <sbarati@apple.com> 2 28 -
trunk/Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp
r239427 r246441 37 37 #include <wtf/text/Base64.h> 38 38 39 #if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA) 40 #include "CDMFairPlayStreaming.h" 41 #include "ISOFairPlayStreamingPsshBox.h" 42 #endif 43 39 44 40 45 namespace WebCore { … … 130 135 return WTF::nullopt; 131 136 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 132 154 for (auto& value : psshBox.keyIDs()) 133 155 keyIDs.append(SharedBuffer::create(WTFMove(value))); -
trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp
r244439 r246441 33 33 #include "CDMRestrictions.h" 34 34 #include "CDMSessionType.h" 35 #include "ISOFairPlayStreamingPsshBox.h"36 35 #include "ISOSchemeInformationBox.h" 37 36 #include "ISOSchemeTypeBox.h" … … 52 51 namespace WebCore { 53 52 54 static const Vector<FourCC>&validFairPlayStreamingSchemes()55 { 56 static NeverDestroyed<Vector<FourCC>> validSchemes = Vector<FourCC>({ 53 const Vector<FourCC>& CDMPrivateFairPlayStreaming::validFairPlayStreamingSchemes() 54 { 55 static NeverDestroyed<Vector<FourCC>> validSchemes = Vector<FourCC>({ 57 56 "cbcs", 58 57 "cbc2", … … 76 75 } 77 76 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() 77 const Vector<uint8_t>& CDMPrivateFairPlayStreaming::fairPlaySystemID() 85 78 { 86 79 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 }); … … 185 178 } 186 179 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 235 180 RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeSinf(const SharedBuffer& buffer) 236 181 { … … 248 193 } 249 194 250 RefPtr<SharedBuffer> CDMPrivateFairPlayStreaming::sanitizeCenc(const SharedBuffer& buffer)251 {252 UNUSED_PARAM(buffer);253 notImplemented();254 return buffer.copy();255 }256 257 195 Optional<Vector<Ref<SharedBuffer>>> CDMPrivateFairPlayStreaming::extractKeyIDsSkd(const SharedBuffer& buffer) 258 196 { … … 268 206 CDMPrivateFairPlayStreaming::sinfName(), 269 207 CDMPrivateFairPlayStreaming::skdName(), 270 #if HAVE(FAIRPLAYSTREAMING_CENC_INITDATA)271 CDMPrivateFairPlayStreaming::cencName(),272 #endif273 208 }); 274 209 return validTypes; … … 282 217 InitDataRegistry::shared().registerInitDataType(CDMPrivateFairPlayStreaming::sinfName(), { CDMPrivateFairPlayStreaming::sanitizeSinf, CDMPrivateFairPlayStreaming::extractKeyIDsSinf }); 283 218 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 #endif287 219 } 288 220 -
trunk/Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h
r244439 r246441 32 32 33 33 namespace WebCore { 34 35 struct FourCC; 34 36 35 37 class CDMFactoryFairPlayStreaming final : public CDMFactory { … … 76 78 static RefPtr<SharedBuffer> sanitizeSkd(const SharedBuffer&); 77 79 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(); 81 82 }; 82 83
Note:
See TracChangeset
for help on using the changeset viewer.