Changeset 290153 in webkit
- Timestamp:
- Feb 18, 2022, 12:30:09 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
PAL/ChangeLog (modified) (1 diff)
-
PAL/pal/spi/cocoa/AVFoundationSPI.h (modified) (4 diffs)
-
platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r290152 r290153 1 2022-02-18 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Make AVFoundationSPI.h robust against changes in system headers 4 https://bugs.webkit.org/show_bug.cgi?id=236787 5 <rdar://89076606> 6 7 Reviewed by Eric Carlson. 8 9 Wrap call-sites in #if HAVE() macros. 10 11 * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: 12 (WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession): 13 (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForRequest const): 14 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense): 15 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData): 16 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest): 17 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID const): 18 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSessionOrGroup): 19 1 20 2022-02-18 Gabriel Nava Marino <gnavamarino@apple.com> 2 21 -
trunk/Source/WebCore/PAL/ChangeLog
r290149 r290153 1 2022-02-18 Jer Noble <jer.noble@apple.com> 2 3 [Cocoa] Make AVFoundationSPI.h robust against changes in system headers 4 https://bugs.webkit.org/show_bug.cgi?id=236787 5 <rdar://89076606> 6 7 Reviewed by Eric Carlson. 8 9 Follow-up: build problems still persist on certain platforms, so the "robustness" 10 changes made previously were not robust enough. The guards in AVFoundationSPI.h were 11 intended to ensure the definitions were present even on builds where the official API 12 is not supported. However, just because the API is not supported does not mean it's not 13 present, which leads to duplicate-interface build errors. 14 15 Fix the AVFoundationSPI.h pragmas to only define the classes and methods where those 16 objects are supported, and in parallel, wrap implementations which use those objects 17 in those same guards (making these checks compile-time in addition to runtime). 18 19 Move the declarations inside the #else (IOW, !USE(APPLE_INTERNAL_SDK)) block above, 20 and wrap each declaration in the correct HAVE() macro. 21 22 * pal/spi/cocoa/AVFoundationSPI.h: 23 1 24 2022-02-18 Brandon Stewart <brandonstewart@apple.com> 2 25 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h
r290076 r290153 221 221 NS_ASSUME_NONNULL_END 222 222 223 #endif // USE(APPLE_INTERNAL_SDK)224 225 #import <AVFoundation/AVPlayerLayer.h>226 227 223 #if HAVE(AVCONTENTKEYSESSION) 228 224 229 #if !USE(APPLE_INTERNAL_SDK) || !HAVE(AVCONTENTKEYREPORTGROUP)225 #if HAVE(AVCONTENTKEYREPORTGROUP) 230 226 @interface AVContentKeyReportGroup : NSObject 231 227 @property (readonly, nullable) NSData *contentProtectionSessionIdentifier; … … 241 237 #endif 242 238 243 #if !USE(APPLE_INTERNAL_SDK) || !HAVE(AVCONTENTKEYSESSIONWILLOUTPUTBEOBSCURED)239 #if HAVE(AVCONTENTKEYSESSIONWILLOUTPUTBEOBSCURED) 244 240 @interface AVContentKeyRequest (OutputObscured) 245 241 NS_ASSUME_NONNULL_BEGIN … … 249 245 #endif 250 246 251 #if !USE(APPLE_INTERNAL_SDK) || !HAVE(AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS)247 #if HAVE(AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS) 252 248 typedef NS_ENUM(NSInteger, AVExternalContentProtectionStatus) { 253 249 AVExternalContentProtectionStatusPending = 0, … … 262 258 263 259 #endif // HAVE(AVCONTENTKEYSESSION) 260 261 #endif // USE(APPLE_INTERNAL_SDK) 262 263 #import <AVFoundation/AVPlayerLayer.h> 264 264 265 265 #if ENABLE(MEDIA_SOURCE) && !USE(APPLE_INTERNAL_SDK) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm
r290108 r290153 51 51 52 52 static NSString * const InitializationDataTypeKey = @"InitializationDataType"; 53 #if HAVE(AVCONTENTKEYREPORTGROUP) 53 54 static NSString * const ContentKeyReportGroupKey = @"ContentKeyReportGroup"; 55 #endif 54 56 static const NSInteger SecurityLevelError = -42811; 55 57 … … 147 149 } 148 150 151 #if HAVE(AVCONTENTKEYREPORTGROUP) 149 152 - (void)contentKeySession:(AVContentKeySession *)session contentProtectionSessionIdentifierDidChangeForKeyGroup:(nullable AVContentKeyReportGroup *)reportGroup 150 153 { … … 159 162 _parent->groupSessionIdentifierChanged(reportGroup, reportGroup.contentProtectionSessionIdentifier); 160 163 } 164 #endif 161 165 162 166 - (void)contentKeySession:(AVContentKeySession *)session externalProtectionStatusDidChangeForContentKeyRequest:(AVContentKeyRequest *)keyRequest … … 248 252 return nullptr; 249 253 254 #if HAVE(AVCONTENTKEYREPORTGROUP) 250 255 if (!PAL::getAVContentKeyReportGroupClass()) 251 256 return nullptr; 257 #endif 252 258 253 259 auto storageURL = this->storageURL(); … … 441 447 } 442 448 449 #if HAVE(AVCONTENTKEYREPORTGROUP) 443 450 static AVContentKeyReportGroup* groupForRequest(AVContentKeyRequest* request) 444 451 { … … 449 456 return group; 450 457 } 458 #endif 451 459 452 460 void CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest(AVContentKeyRequest *request) … … 545 553 void CDMInstanceFairPlayStreamingAVFObjC::groupSessionIdentifierChanged(AVContentKeyReportGroup* group, NSData *sessionIdentifier) 546 554 { 555 #if HAVE(AVCONTENTKEYREPORTGROUP) 547 556 if (group == [m_session defaultContentKeyGroup]) { 548 557 INFO_LOG_IF_POSSIBLE(LOGIDENTIFIER, "- default unused group identifier changed; dropping"); … … 557 566 ASSERT_NOT_REACHED(); 558 567 ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "- no responsible session; dropping"); 568 #else 569 UNUSED_PARAM(group); 570 UNUSED_PARAM(sessionIdentifier); 571 #endif 559 572 } 560 573 … … 604 617 return m_sessions[index].get(); 605 618 619 #if HAVE(AVCONTENTKEYREPORTGROUP) 606 620 return sessionForGroup(groupForRequest(request)); 607 } 608 621 #else 622 return nullptr; 623 #endif 624 } 625 626 #if HAVE(AVCONTENTKEYREPORTGROUP) 609 627 CDMInstanceSessionFairPlayStreamingAVFObjC* CDMInstanceFairPlayStreamingAVFObjC::sessionForGroup(AVContentKeyReportGroup* group) const 610 628 { … … 617 635 return nullptr; 618 636 } 637 #endif 619 638 620 639 bool CDMInstanceFairPlayStreamingAVFObjC::isAnyKeyUsable(const Keys& keys) const … … 726 745 if (auto unexpectedRequest = m_instance->takeUnexpectedKeyRequestForInitializationData(initDataType, initData)) { 727 746 DEBUG_LOG_IF_POSSIBLE(LOGIDENTIFIER, " found unexpectedRequest matching initData"); 747 #if HAVE(AVCONTENTKEYREPORTGROUP) 728 748 if (m_group) { 729 749 ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN … … 731 751 ALLOW_NEW_API_WITHOUT_GUARDS_END 732 752 } 753 #endif 733 754 m_requestLicenseCallback = WTFMove(callback); 734 755 didProvideRequest(unexpectedRequest.get()); … … 758 779 m_requestLicenseCallback = WTFMove(callback); 759 780 781 #if HAVE(AVCONTENTKEYREPORTGROUP) 760 782 if (m_group) { 761 783 auto* options = @{ ContentKeyReportGroupKey: m_group.get(), InitializationDataTypeKey: (NSString*)initDataType }; 762 784 [m_group processContentKeyRequestWithIdentifier:identifier.get() initializationData:initializationData.get() options:options]; 763 } else { 764 auto* options = @{ InitializationDataTypeKey: (NSString*)initDataType }; 765 [m_session processContentKeyRequestWithIdentifier:identifier.get() initializationData:initializationData.get() options:options]; 766 } 785 return; 786 } 787 #endif 788 789 auto* options = @{ InitializationDataTypeKey: (NSString*)initDataType }; 790 [m_session processContentKeyRequestWithIdentifier:identifier.get() initializationData:initializationData.get() options:options]; 767 791 } 768 792 … … 1012 1036 void CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData(const String& sessionId, LicenseType licenseType, RemoveSessionDataCallback&& callback) 1013 1037 { 1038 #if HAVE(AVCONTENTKEYREPORTGROUP) 1014 1039 if (m_group) 1015 1040 [m_group expire]; 1016 1041 else 1042 #endif 1017 1043 [m_session expire]; 1018 1044 … … 1133 1159 1134 1160 if (m_sessionId.isEmpty()) { 1135 auto sessionID = m_group ? m_group.get().contentProtectionSessionIdentifier : m_session.get().contentProtectionSessionIdentifier; 1161 NSData *sessionID = nullptr; 1162 #if HAVE(AVCONTENTKEYREPORTGROUP) 1163 if (m_group) 1164 sessionID = m_group.get().contentProtectionSessionIdentifier; 1165 else 1166 #endif 1167 sessionID = m_session.get().contentProtectionSessionIdentifier; 1136 1168 sessionIdentifierChanged(sessionID); 1137 1169 } … … 1418 1450 void CDMInstanceSessionFairPlayStreamingAVFObjC::groupSessionIdentifierChanged(AVContentKeyReportGroup*, NSData *sessionIdentifier) 1419 1451 { 1452 #if HAVE(AVCONTENTKEYREPORTGROUP) 1420 1453 sessionIdentifierChanged(sessionIdentifier); 1454 #else 1455 UNUSED_PARAM(sessionIdentifier); 1456 #endif 1421 1457 } 1422 1458 … … 1508 1544 #endif 1509 1545 1546 #if HAVE(AVCONTENTKEYSESSIONWILLOUTPUTBEOBSCURED) 1510 1547 // FIXME: AVFoundation requires a connection to the WindowServer in order to query the HDCP status of individual 1511 1548 // displays. Passing in an empty NSArray will cause AVFoundation to fall back to a "minimum supported HDCP level" … … 1526 1563 return obscured ? CDMKeyStatus::OutputRestricted : CDMKeyStatus::Usable; 1527 1564 } 1565 #endif 1528 1566 1529 1567 // Only use the non-request-specific "outputObscuredDueToInsufficientExternalProtection" status if … … 1549 1587 bool CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSessionOrGroup() 1550 1588 { 1551 if (m_session || m_group) 1589 if (m_session) 1590 return true; 1591 1592 #if HAVE(AVCONTENTKEYREPORTGROUP) 1593 if (m_group) 1552 1594 return true; 1553 1595 … … 1556 1598 return true; 1557 1599 } 1600 #endif 1558 1601 1559 1602 auto storageURL = m_instance->storageURL();
Note:
See TracChangeset
for help on using the changeset viewer.