Title: [262364] trunk/Source/WebCore
Revision
262364
Author
[email protected]
Date
2020-05-31 11:51:35 -0700 (Sun, 31 May 2020)

Log Message

[Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
https://bugs.webkit.org/show_bug.cgi?id=212550
<rdar://problem/62207260>

Reviewed by Eric Carlson.

Source/WebCore:

CoreMedia returns a different codec 4CC code for "encrypted AVC" than it does for "clear AVC", though
the underlying codec used for both is the same. While CoreMedia does use different codec implementations
for each, it is capable of freely switching between the two, and the codec string used by web developers
for encrypted vs. clear content is identical. So we will treat these two codecs as "the same" as it pertains
to the MSE requirement that codecs contained in new initialization segments are "the same" as previous
ones. Adopt kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, which can query the "original"
codec used for encrypted codec playback.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:

Source/WebCore/PAL:

* pal/cf/CoreMediaSoftLink.cpp:
* pal/cf/CoreMediaSoftLink.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (262363 => 262364)


--- trunk/Source/WebCore/ChangeLog	2020-05-31 18:02:42 UTC (rev 262363)
+++ trunk/Source/WebCore/ChangeLog	2020-05-31 18:51:35 UTC (rev 262364)
@@ -1,3 +1,21 @@
+2020-05-31  Jer Noble  <[email protected]>
+
+        [Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
+        https://bugs.webkit.org/show_bug.cgi?id=212550
+        <rdar://problem/62207260>
+
+        Reviewed by Eric Carlson.
+
+        CoreMedia returns a different codec 4CC code for "encrypted AVC" than it does for "clear AVC", though
+        the underlying codec used for both is the same. While CoreMedia does use different codec implementations
+        for each, it is capable of freely switching between the two, and the codec string used by web developers
+        for encrypted vs. clear content is identical. So we will treat these two codecs as "the same" as it pertains
+        to the MSE requirement that codecs contained in new initialization segments are "the same" as previous
+        ones. Adopt kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, which can query the "original"
+        codec used for encrypted codec playback.
+
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+
 2020-05-31  Zalan Bujtas  <[email protected]>
 
         [iBooks] Empty pages appear in book

Modified: trunk/Source/WebCore/PAL/ChangeLog (262363 => 262364)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-05-31 18:02:42 UTC (rev 262363)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-05-31 18:51:35 UTC (rev 262364)
@@ -1,3 +1,14 @@
+2020-05-31  Jer Noble  <[email protected]>
+
+        [Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
+        https://bugs.webkit.org/show_bug.cgi?id=212550
+        <rdar://problem/62207260>
+
+        Reviewed by Eric Carlson.
+
+        * pal/cf/CoreMediaSoftLink.cpp:
+        * pal/cf/CoreMediaSoftLink.h:
+
 2020-05-30  David Kilzer  <[email protected]>
 
         REGRESSION (r262332): Windows build failure because <nw/private.h> doesn't exist

Modified: trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp (262363 => 262364)


--- trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp	2020-05-31 18:02:42 UTC (rev 262363)
+++ trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp	2020-05-31 18:51:35 UTC (rev 262364)
@@ -167,6 +167,7 @@
 SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, CoreMedia, CMClockGetTime, CMTime, (CMClockRef clock), (clock), PAL_EXPORT)
 SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, CoreMedia, CMSampleBufferCallForEachSample, OSStatus, (CMSampleBufferRef sbuf, OSStatus (* CMSAMPLEBUFFERCALL_NOESCAPE callback)( CMSampleBufferRef sampleBuffer, CMItemCount index, void *refcon), void *refcon), (sbuf, callback, refcon), PAL_EXPORT)
 SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, CoreMedia, CMSampleBufferCallBlockForEachSample, OSStatus, (CMSampleBufferRef sbuf, OSStatus (^ CMSAMPLEBUFFERCALL_NOESCAPE handler)(CMSampleBufferRef, CMItemCount)), (sbuf, handler), PAL_EXPORT)
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, CoreMedia, kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, CFStringRef, PAL_EXPORT)
 
 #endif // PLATFORM(COCOA)
 

Modified: trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h (262363 => 262364)


--- trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h	2020-05-31 18:02:42 UTC (rev 262363)
+++ trunk/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h	2020-05-31 18:51:35 UTC (rev 262364)
@@ -84,6 +84,8 @@
 
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, CoreMedia, kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms, CFStringRef)
 #define kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms get_CoreMedia_kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms()
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(PAL, CoreMedia, kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, CFStringRef)
+#define kCMFormatDescriptionExtension_ProtectedContentOriginalFormat get_CoreMedia_kCMFormatDescriptionExtension_ProtectedContentOriginalFormat()
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, CoreMedia, kCMTextMarkupAlignmentType_End, CFStringRef)
 #define kCMTextMarkupAlignmentType_End get_CoreMedia_kCMTextMarkupAlignmentType_End()
 SOFT_LINK_CONSTANT_FOR_HEADER(PAL, CoreMedia, kCMTextMarkupAlignmentType_Middle, CFStringRef)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (262363 => 262364)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2020-05-31 18:02:42 UTC (rev 262363)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2020-05-31 18:51:35 UTC (rev 262364)
@@ -413,6 +413,10 @@
         CMFormatDescriptionRef description = [formatDescriptions count] ? (__bridge CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0] : 0;
         if (description) {
             FourCharCode codec = CMFormatDescriptionGetMediaSubType(description);
+            CFStringRef originalFormatKey = PAL::canLoad_CoreMedia_kCMFormatDescriptionExtension_ProtectedContentOriginalFormat() ? PAL::get_CoreMedia_kCMFormatDescriptionExtension_ProtectedContentOriginalFormat() : CFSTR("CommonEncryptionOriginalFormat");
+            CFTypeRef originalFormat = CMFormatDescriptionGetExtension(description, originalFormatKey);
+            if (originalFormat && CFGetTypeID(originalFormat) == CFNumberGetTypeID())
+                CFNumberGetValue((CFNumberRef)originalFormat, kCFNumberLongType, &codec);
             m_codec = AtomString(reinterpret_cast<LChar*>(&codec), 4);
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to