Changeset 242720 in webkit
- Timestamp:
- Mar 11, 2019, 11:30:11 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
-
ChangeLog (modified) (1 diff)
-
Modules/encryptedmedia/legacy/LegacyCDM.cpp (modified) (2 diffs)
-
platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h (modified) (1 diff)
-
platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm (modified) (4 diffs)
-
platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h (modified) (2 diffs)
-
platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm (modified) (11 diffs)
-
platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (modified) (3 diffs)
-
platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (modified) (2 diffs)
-
platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242714 r242720 1 2019-03-11 Jer Noble <jer.noble@apple.com> 2 3 Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession is absent 4 https://bugs.webkit.org/show_bug.cgi?id=195462 5 <rdar://problem/48712306> 6 7 Reviewed by Eric Carlson. 8 9 The difference between "com.apple.fps.2_0" and "3_0" is a protocol difference more than an 10 implementation difference. In "2_0", the "EME nitialization" data comes in the form of a "content 11 identifier", while the true initialization data is retrieved through a side channel directly from 12 the attached element. In "3_0", the "EME initialization data" is the exact initialization data 13 given by the parser, with no "content identifier" at all. 14 15 In the original implementation, the "2_0" used AVStreamSession, and "3_0" used AVContentKeySession, 16 but in the absense of AVStreamSession, those protocol differences are minor and can be implemented 17 using AVContentKeySession. 18 19 Changes: 20 21 - Add a new helper struct in CDMPrivateMediaSourceAVFObjC that represents the parsed parameters 22 of the CDM string. 23 - Add an "initData()" accessor to SourceBufferPrivateAVFObjC so that the "2_0" path can implement 24 the side channel access to the necessary initialization data. 25 - Refactor some of the SPI code to not re-declare unnecessary APIs. 26 - In CDMSessionAVContentKeySession::generateKeyRequest(), this function can never be called twice 27 so it is a logical impossibility to have a certificate at this point. Remove all this if() code. 28 29 * Modules/encryptedmedia/legacy/LegacyCDM.cpp: 30 * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h: 31 * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: 32 (WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem): 33 (WebCore::queryDecoderAvailability): 34 (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem): 35 (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): 36 (WebCore::validKeySystemRE): Deleted. 37 * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h: 38 * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: 39 (WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession): 40 (WebCore::CDMSessionAVContentKeySession::generateKeyRequest): 41 (WebCore::CDMSessionAVContentKeySession::update): 42 (WebCore::CDMSessionAVContentKeySession::addParser): 43 (WebCore::CDMSessionAVContentKeySession::removeParser): 44 (WebCore::CDMSessionAVContentKeySession::contentKeySession): 45 * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: 46 * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: 47 (WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession): 48 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 49 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 50 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession): 51 * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: 52 * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: 53 (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): 54 1 55 2019-03-11 Ryan Haddad <ryanhaddad@apple.com> 2 56 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp
r223728 r242720 38 38 #include <wtf/text/WTFString.h> 39 39 40 #if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE)40 #if (HAVE(AVCONTENTKEYSESSION) || HAVE(AVSTREAMSESSION)) && ENABLE(MEDIA_SOURCE) 41 41 #include "CDMPrivateMediaSourceAVFObjC.h" 42 42 #endif … … 69 69 CDMPrivateMediaPlayer::supportsKeySystem, CDMPrivateMediaPlayer::supportsKeySystemAndMimeType), 70 70 71 #if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE)71 #if (HAVE(AVCONTENTKEYSESSION) || HAVE(AVSTREAMSESSION)) && ENABLE(MEDIA_SOURCE) 72 72 new CDMFactory([](LegacyCDM* cdm) { return std::make_unique<CDMPrivateMediaSourceAVFObjC>(cdm); }, 73 73 CDMPrivateMediaSourceAVFObjC::supportsKeySystem, CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType), -
trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h
r222946 r242720 53 53 54 54 void invalidateSession(CDMSessionMediaSourceAVFObjC*); 55 56 55 protected: 56 struct KeySystemParameters { 57 int version; 58 Vector<int> protocols; 59 }; 60 static Optional<KeySystemParameters> parseKeySystem(const String& keySystem); 61 57 62 LegacyCDM* m_cdm; 58 63 Vector<CDMSessionMediaSourceAVFObjC*> m_sessions; -
trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm
r240592 r242720 44 44 namespace WebCore { 45 45 46 static RegularExpression& validKeySystemRE() 46 auto CDMPrivateMediaSourceAVFObjC::parseKeySystem(const String& keySystem) -> Optional<KeySystemParameters> 47 47 { 48 48 static NeverDestroyed<RegularExpression> keySystemRE("^com\\.apple\\.fps\\.[23]_\\d+(?:,\\d+)*$", JSC::Yarr::TextCaseInsensitive); 49 return keySystemRE; 49 50 if (keySystem.isEmpty()) 51 return WTF::nullopt; 52 53 if (keySystemRE.get().match(keySystem) < 0) 54 return WTF::nullopt; 55 56 StringView keySystemView { keySystem }; 57 58 int cdmVersion = keySystemView.substring(14, 1).toInt(); 59 60 Vector<int> protocolVersions; 61 for (StringView protocolVersionString : keySystemView.substring(16).split(',')) 62 protocolVersions.append(protocolVersionString.toInt()); 63 64 return {{ cdmVersion, WTFMove(protocolVersions) }}; 50 65 } 51 66 … … 59 74 { 60 75 if (!canLoad_VideoToolbox_VTGetGVADecoderAvailability()) 76 #if HAVE(AVSTREAMSESSION) 61 77 return false; 78 #else 79 return true; 80 #endif 62 81 uint32_t totalInstanceCount = 0; 63 82 OSStatus status = VTGetGVADecoderAvailability(&totalInstanceCount, nullptr); … … 70 89 return false; 71 90 72 if (!keySystem.isEmpty() && validKeySystemRE().match(keySystem) < 0) 91 auto parameters = parseKeySystem(keySystem); 92 if (!parameters) 73 93 return false; 74 94 75 if ( keySystem.substring(14, 1).toInt()== 3 && !CDMSessionAVContentKeySession::isAvailable())95 if (parameters.value().version == 3 && !CDMSessionAVContentKeySession::isAvailable()) 76 96 return false; 77 97 … … 114 134 { 115 135 String keySystem = m_cdm->keySystem(); // Local copy for StringView usage 116 StringView keySystemStringView { keySystem }; 117 ASSERT(validKeySystemRE().match(keySystem) >= 0); 118 119 Vector<int> protocolVersions; 120 for (StringView protocolVersionString : keySystemStringView.substring(16).split(',')) 121 protocolVersions.append(protocolVersionString.toInt()); 136 auto parameters = parseKeySystem(m_cdm->keySystem()); 137 ASSERT(parameters); 138 if (!parameters) 139 return nullptr; 122 140 123 141 std::unique_ptr<CDMSessionMediaSourceAVFObjC> session; 124 if (keySystemStringView.substring(14, 1).toInt() == 3 && CDMSessionAVContentKeySession::isAvailable()) 125 session = std::make_unique<CDMSessionAVContentKeySession>(protocolVersions, *this, client); 142 143 #if HAVE(AVSTREAMSESSION) 144 bool shouldUseAVContentKeySession = parameters.value().version == 3; 145 #else 146 bool shouldUseAVContentKeySession = true; 147 #endif 148 149 if (shouldUseAVContentKeySession && CDMSessionAVContentKeySession::isAvailable()) 150 session = std::make_unique<CDMSessionAVContentKeySession>(WTFMove(parameters.value().protocols), parameters.value().version, *this, client); 126 151 else 127 #if HAVE(AVSTREAMSESSION) && ENABLE(LEGACY_ENCRYPTED_MEDIA)128 session = std::make_unique<CDMSessionAVStreamSession>( protocolVersions, *this, client);152 #if HAVE(AVSTREAMSESSION) 153 session = std::make_unique<CDMSessionAVStreamSession>(WTFMove(parameters.value().protocols), *this, client); 129 154 #else 130 155 return nullptr; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h
r241183 r242720 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 CDMSessionAVContentKeySession( const Vector<int>& protocolVersions, CDMPrivateMediaSourceAVFObjC&, LegacyCDMSessionClient*);46 CDMSessionAVContentKeySession(Vector<int>&& protocolVersions, int cdmVersion, CDMPrivateMediaSourceAVFObjC&, LegacyCDMSessionClient*); 47 47 virtual ~CDMSessionAVContentKeySession(); 48 48 … … 70 70 RetainPtr<WebCDMSessionAVContentKeySessionDelegate> m_contentKeySessionDelegate; 71 71 RetainPtr<AVContentKeyRequest> m_keyRequest; 72 RefPtr<Uint8Array> m_identifier; 72 73 RefPtr<Uint8Array> m_initData; 73 74 RetainPtr<NSData> m_expiredSession; 74 75 Vector<int> m_protocolVersions; 76 int m_cdmVersion; 75 77 int32_t m_protectedTrackID { 1 }; 76 78 enum { Normal, KeyRelease } m_mode; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm
r240437 r242720 39 39 #import <JavaScriptCore/TypedArrayInlines.h> 40 40 #import <objc/objc-runtime.h> 41 #import <pal/spi/mac/AVFoundationSPI.h> 41 42 #import <wtf/FileSystem.h> 42 43 #import <wtf/SoftLinking.h> … … 45 46 SOFT_LINK_CLASS(AVFoundation, AVStreamDataParser); 46 47 SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVContentKeySession); 48 SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVContentKeyResponse); 47 49 SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeyRequestProtocolVersionsKey, NSString *) 48 50 SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeySystemFairPlayStreaming, NSString *) … … 50 52 typedef NSString *AVContentKeySystem; 51 53 52 @interface AVContentKeySession : NSObject 53 + (instancetype)contentKeySessionWithKeySystem:(AVContentKeySystem)keySystem; 54 @interface AVContentKeySession (WebCorePrivate) 54 55 - (instancetype)initWithStorageDirectoryAtURL:(NSURL *)storageURL; 55 56 @property (assign) id delegate; 56 57 - (void)addStreamDataParser:(AVStreamDataParser *)streamDataParser; 57 58 - (void)removeStreamDataParser:(AVStreamDataParser *)streamDataParser; 58 @property (readonly) NSArray *streamDataParsers;59 - (void)expire;60 @property (readonly) NSData *contentProtectionSessionIdentifier;61 59 - (void)processContentKeyRequestInitializationData:(NSData *)initializationData options:(NSDictionary *)options; 62 + (NSArray *)pendingExpiredSessionReportsWithAppIdentifier:(NSData *)appIdentifier storageDirectoryAtURL:(NSURL *)storageURL;63 + (void)removePendingExpiredSessionReports:(NSArray *)expiredSessionReports withAppIdentifier:(NSData *)appIdentifier storageDirectoryAtURL:(NSURL *)storageURL;64 60 @end 65 61 66 typedef NS_ENUM(NSInteger, AVContentKeyRequestStatus) { 67 AVContentKeySessionStatusNoKey, 68 AVContentKeySessionStatusRequestingKey, 69 AVContentKeySessionStatusKeyPresent, 70 AVContentKeySessionStatusExpired, 71 AVContentKeySessionStatusFailed 72 }; 73 74 @interface AVContentKeyRequest : NSObject 75 @property (readonly) AVContentKeyRequestStatus status; 76 @property (readonly) NSError *error; 77 @property (readonly) NSData *initializationData; 62 @interface AVContentKeyRequest (WebCorePrivate) 78 63 - (NSData *)contentKeyRequestDataForApp:(NSData *)appIdentifier contentIdentifier:(NSData *)contentIdentifier options:(NSDictionary *)options error:(NSError **)outError; 79 64 - (void)processContentKeyResponseData:(NSData *)contentKeyResponseData; 80 - (void)processContentKeyResponseError:(NSError *)error;81 65 - (void)renewExpiringContentKeyResponseData; 82 66 @end 83 67 84 @interface WebCDMSessionAVContentKeySessionDelegate : NSObject {68 @interface WebCDMSessionAVContentKeySessionDelegate : NSObject<AVContentKeySessionDelegate> { 85 69 WebCore::CDMSessionAVContentKeySession *m_parent; 86 70 } … … 125 109 namespace WebCore { 126 110 127 CDMSessionAVContentKeySession::CDMSessionAVContentKeySession( const Vector<int>& protocolVersions, CDMPrivateMediaSourceAVFObjC& cdm, LegacyCDMSessionClient* client)111 CDMSessionAVContentKeySession::CDMSessionAVContentKeySession(Vector<int>&& protocolVersions, int cdmVersion, CDMPrivateMediaSourceAVFObjC& cdm, LegacyCDMSessionClient* client) 128 112 : CDMSessionMediaSourceAVFObjC(cdm, client) 129 113 , m_contentKeySessionDelegate(adoptNS([[WebCDMSessionAVContentKeySessionDelegate alloc] initWithParent:this])) 130 , m_protocolVersions(protocolVersions) 114 , m_protocolVersions(WTFMove(protocolVersions)) 115 , m_cdmVersion(cdmVersion) 131 116 , m_mode(Normal) 132 117 { … … 157 142 systemCode = 0; 158 143 159 m_initData = initData;160 161 144 if (equalLettersIgnoringASCIICase(mimeType, "keyrelease")) { 162 145 m_mode = KeyRelease; 146 m_certificate = initData; 163 147 return generateKeyReleaseMessage(errorCode, systemCode); 164 148 } 165 149 166 if (!m_certificate) { 167 String certificateString("certificate"_s); 168 auto array = Uint8Array::create(certificateString.length()); 169 for (unsigned i = 0, length = certificateString.length(); i < length; ++i) 170 array->set(i, certificateString[i]); 171 return WTFMove(array); 172 } 173 174 if (!m_keyRequest) { 175 NSData* nsInitData = [NSData dataWithBytes:m_initData->data() length:m_initData->length()]; 176 [contentKeySession() processContentKeyRequestInitializationData:nsInitData options:nil]; 177 } 178 179 return nullptr; 150 if (m_cdmVersion == 2) 151 m_identifier = initData; 152 else 153 m_initData = initData; 154 155 ASSERT(!m_certificate); 156 String certificateString("certificate"_s); 157 auto array = Uint8Array::create(certificateString.length()); 158 for (unsigned i = 0, length = certificateString.length(); i < length; ++i) 159 array->set(i, certificateString[i]); 160 return WTFMove(array); 180 161 } 181 162 … … 269 250 if (m_mode == KeyRelease) 270 251 return false; 252 253 if (m_cdmVersion == 2) { 254 // In the com.apple.fps.2_0 communication protocol, the client must first attach the 255 // session to the protected SourceBuffer in order to get access to the initialization 256 // data. 257 RefPtr<SourceBufferPrivateAVFObjC> protectedSourceBuffer; 258 for (auto& sourceBuffer : m_sourceBuffers) { 259 if (sourceBuffer->protectedTrackID() != -1) { 260 protectedSourceBuffer = sourceBuffer; 261 break; 262 } 263 } 264 265 if (!protectedSourceBuffer) { 266 errorCode = MediaPlayer::InvalidPlayerState; 267 return false; 268 } 269 270 m_initData = protectedSourceBuffer->initData(); 271 } 271 272 272 273 if (!m_keyRequest) { 273 NSData* nsInitData = [NSData dataWithBytes:m_initData->data() length:m_initData->length()]; 274 [contentKeySession() processContentKeyRequestInitializationData:nsInitData options:nil]; 274 NSData* nsInitData = m_initData ? [NSData dataWithBytes:m_initData->data() length:m_initData->length()] : nil; 275 NSData* nsIdentifier = m_identifier ? [NSData dataWithBytes:m_identifier->data() length:m_identifier->length()] : nil; 276 if ([contentKeySession() respondsToSelector:@selector(processContentKeyRequestWithIdentifier:initializationData:options:)]) 277 [contentKeySession() processContentKeyRequestWithIdentifier:nsIdentifier initializationData:nsInitData options:nil]; 278 else 279 [contentKeySession() processContentKeyRequestInitializationData:nsInitData options:nil]; 275 280 } 276 281 … … 294 299 systemCode = 0; 295 300 NSError* error = nil; 296 NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nil options:options.get() error:&error]; 301 NSData* nsIdentifier = m_identifier ? [NSData dataWithBytes:m_identifier->data() length:m_identifier->length()] : m_keyRequest.get().identifier; 302 303 NSData* requestData = [m_keyRequest contentKeyRequestDataForApp:certificateData.get() contentIdentifier:nsIdentifier options:options.get() error:&error]; 297 304 if (error) { 298 305 errorCode = LegacyCDM::DomainError; … … 309 316 systemCode = 0; 310 317 RetainPtr<NSData> keyData = adoptNS([[NSData alloc] initWithBytes:key->data() length:key->length()]); 311 [m_keyRequest processContentKeyResponseData:keyData.get()]; 318 319 if ([m_keyRequest respondsToSelector:@selector(processContentKeyResponse:)] && [getAVContentKeyResponseClass() respondsToSelector:@selector(contentKeyResponseWithFairPlayStreamingKeyResponseData:)]) 320 [m_keyRequest processContentKeyResponse:[getAVContentKeyResponseClass() contentKeyResponseWithFairPlayStreamingKeyResponseData:keyData.get()]]; 321 else 322 [m_keyRequest processContentKeyResponseData:keyData.get()]; 312 323 313 324 return true; … … 316 327 void CDMSessionAVContentKeySession::addParser(AVStreamDataParser* parser) 317 328 { 318 [contentKeySession() addStreamDataParser:parser]; 329 if ([contentKeySession() respondsToSelector:@selector(addContentKeyRecipient:)]) 330 [contentKeySession() addContentKeyRecipient:parser]; 331 else 332 [contentKeySession() addStreamDataParser:parser]; 319 333 } 320 334 321 335 void CDMSessionAVContentKeySession::removeParser(AVStreamDataParser* parser) 322 336 { 323 [contentKeySession() removeStreamDataParser:parser]; 337 if ([contentKeySession() respondsToSelector:@selector(removeContentKeyRecipient:)]) 338 [contentKeySession() removeContentKeyRecipient:parser]; 339 else 340 [contentKeySession() removeStreamDataParser:parser]; 324 341 } 325 342 … … 327 344 { 328 345 ASSERT(m_mode == KeyRelease); 329 m_certificate = m_initData;330 346 RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]); 331 347 … … 378 394 } 379 395 380 m_contentKeySession = adoptNS([allocAVContentKeySessionInstance() initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]); 396 auto url = [NSURL fileURLWithPath:storagePath]; 397 if ([getAVContentKeySessionClass() respondsToSelector:@selector(contentKeySessionWithKeySystem:storageDirectoryAtURL:)] && canLoadAVContentKeySystemFairPlayStreaming()) 398 m_contentKeySession = [getAVContentKeySessionClass() contentKeySessionWithKeySystem:getAVContentKeySystemFairPlayStreaming() storageDirectoryAtURL:url]; 399 else 400 m_contentKeySession = adoptNS([allocAVContentKeySessionInstance() initWithStorageDirectoryAtURL:url]); 381 401 } 382 402 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h
r241183 r242720 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 CDMSessionAVStreamSession( const Vector<int>& protocolVersions, CDMPrivateMediaSourceAVFObjC&, LegacyCDMSessionClient*);46 CDMSessionAVStreamSession(Vector<int>&& protocolVersions, CDMPrivateMediaSourceAVFObjC&, LegacyCDMSessionClient*); 47 47 virtual ~CDMSessionAVStreamSession(); 48 48 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm
r240592 r242720 88 88 namespace WebCore { 89 89 90 CDMSessionAVStreamSession::CDMSessionAVStreamSession( const Vector<int>& protocolVersions, CDMPrivateMediaSourceAVFObjC& cdm, LegacyCDMSessionClient* client)90 CDMSessionAVStreamSession::CDMSessionAVStreamSession(Vector<int>&& protocolVersions, CDMPrivateMediaSourceAVFObjC& cdm, LegacyCDMSessionClient* client) 91 91 : CDMSessionMediaSourceAVFObjC(cdm, client) 92 92 , m_dataParserObserver(adoptNS([[WebCDMSessionAVStreamSessionObserver alloc] initWithParent:this])) 93 , m_protocolVersions( protocolVersions)93 , m_protocolVersions(WTFMove(protocolVersions)) 94 94 , m_mode(Normal) 95 95 { -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r241148 r242720 116 116 void syncTextTrackBounds() override; 117 117 118 #if HAVE(AVSTREAMSESSION) && ENABLE(LEGACY_ENCRYPTED_MEDIA) 118 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 119 #if HAVE(AVSTREAMSESSION) 119 120 bool hasStreamSession() { return m_streamSession; } 120 121 AVStreamSession *streamSession(); 122 #endif 121 123 void setCDMSession(LegacyCDMSession*) override; 122 124 CDMSessionMediaSourceAVFObjC* cdmSession() const { return m_session.get(); } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r241148 r242720 934 934 } 935 935 936 #if HAVE(AVSTREAMSESSION) && ENABLE(LEGACY_ENCRYPTED_MEDIA) 936 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 937 #if HAVE(AVSTREAMSESSION) 937 938 AVStreamSession* MediaPlayerPrivateMediaSourceAVFObjC::streamSession() 938 939 { … … 955 956 return m_streamSession.get(); 956 957 } 958 #endif 957 959 958 960 void MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession(LegacyCDMSession* session) … … 965 967 m_session = makeWeakPtr(toCDMSessionMediaSourceAVFObjC(session)); 966 968 969 #if HAVE(AVSTREAMSESSION) 967 970 if (CDMSessionAVStreamSession* cdmStreamSession = toCDMSessionAVStreamSession(m_session.get())) 968 971 cdmStreamSession->setStreamSession(streamSession()); 972 #endif 973 969 974 for (auto& sourceBuffer : m_mediaSourcePrivate->sourceBuffers()) 970 975 sourceBuffer->setCDMSession(m_session.get()); 971 976 } 972 #endif // HAVE(AVSTREAMSESSION) &&ENABLE(LEGACY_ENCRYPTED_MEDIA)977 #endif // ENABLE(LEGACY_ENCRYPTED_MEDIA) 973 978 974 979 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
r241148 r242720 134 134 135 135 void bufferWasConsumed(); 136 137 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 138 Uint8Array* initData() { return m_initData.get(); } 139 #endif 136 140 137 141 #if !RELEASE_LOG_DISABLED … … 197 201 SourceBufferPrivateClient* m_client { nullptr }; 198 202 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 203 RefPtr<Uint8Array> m_initData; 199 204 WeakPtr<CDMSessionMediaSourceAVFObjC> m_session { nullptr }; 200 205 #endif -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
r242631 r242720 662 662 return; 663 663 664 #if HAVE(AV STREAMSESSION) && ENABLE(LEGACY_ENCRYPTED_MEDIA)664 #if HAVE(AVCONTENTKEYSESSION) && ENABLE(LEGACY_ENCRYPTED_MEDIA) 665 665 ALWAYS_LOG(LOGIDENTIFIER, "track = ", trackID); 666 666 667 667 m_protectedTrackID = trackID; 668 auto initDataArray= Uint8Array::create([initData length]);669 [initData getBytes: initDataArray->data() length:initDataArray->length()];670 m_mediaSource->sourceBufferKeyNeeded(this, initDataArray.ptr());668 m_initData = Uint8Array::create([initData length]); 669 [initData getBytes:m_initData->data() length:m_initData->length()]; 670 m_mediaSource->sourceBufferKeyNeeded(this, m_initData.get()); 671 671 if (auto session = m_mediaSource->player()->cdmSession()) { 672 672 session->addParser(m_parser.get());
Note:
See TracChangeset
for help on using the changeset viewer.