Title: [264742] trunk/Source/WebCore
Revision
264742
Author
jer.no...@apple.com
Date
2020-07-22 20:01:25 -0700 (Wed, 22 Jul 2020)

Log Message

[Cocoa|WebM] Decode error when seeking
https://bugs.webkit.org/show_bug.cgi?id=214666

Reviewed by Eric Carlson.

A decoder error is hit when seeking because we think all samples coming out of the SourceBufferParserWebM are sync-samples.
This is because the attachment added with CMSetAttachment() is ignored; the correct way to set sample attachments is by
getting the sample attachments array with CMSampleBufferGetSampleAttachmentsArray(), and then iterating over the attachments
and adding keys to the underlying mutable CFDictionary.

* platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::SourceBufferParserWebM::OnFrame):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (264741 => 264742)


--- trunk/Source/WebCore/ChangeLog	2020-07-23 01:49:25 UTC (rev 264741)
+++ trunk/Source/WebCore/ChangeLog	2020-07-23 03:01:25 UTC (rev 264742)
@@ -1,3 +1,18 @@
+2020-07-22  Jer Noble  <jer.no...@apple.com>
+
+        [Cocoa|WebM] Decode error when seeking
+        https://bugs.webkit.org/show_bug.cgi?id=214666
+
+        Reviewed by Eric Carlson.
+
+        A decoder error is hit when seeking because we think all samples coming out of the SourceBufferParserWebM are sync-samples.
+        This is because the attachment added with CMSetAttachment() is ignored; the correct way to set sample attachments is by
+        getting the sample attachments array with CMSampleBufferGetSampleAttachmentsArray(), and then iterating over the attachments
+        and adding keys to the underlying mutable CFDictionary.
+
+        * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
+        (WebCore::SourceBufferParserWebM::OnFrame):
+
 2020-07-22  Fujii Hironori  <hironori.fu...@sony.com>
 
         [WinCairo][32bit] JPEG2000ImageDecoder.cpp: error C2664: 'std::unique_ptr<...>::unique_ptr(...)': cannot convert argument 2 from 'void (__stdcall *)(opj_codec_t *)' to 'const _Dx &'

Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (264741 => 264742)


--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-07-23 01:49:25 UTC (rev 264741)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-07-23 03:01:25 UTC (rev 264742)
@@ -42,6 +42,7 @@
 #include <wtf/Algorithms.h>
 #include <wtf/Deque.h>
 #include <wtf/NeverDestroyed.h>
+#include <wtf/cf/TypeCastsCF.h>
 #include <wtf/darwin/WeakLinking.h>
 
 WTF_WEAK_LINK_FORCE_IMPORT(webm::swap);
@@ -793,8 +794,16 @@
         trackData->currentBlockBuffer = nullptr;
         trackData->currentBlockBufferPosition = 0;
 
-        if (!isSync)
-            CMSetAttachment(sampleBuffer.get(), kCMSampleAttachmentKey_NotSync, kCFBooleanTrue, kCMAttachmentMode_ShouldPropagate);
+        if (!isSync) {
+            auto attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer.get(), true);
+            ASSERT(attachmentsArray);
+            if (!attachmentsArray)
+                return Skip(reader, bytesRemaining);
+            for (CFIndex i = 0, count = CFArrayGetCount(attachmentsArray); i < count; ++i) {
+                CFMutableDictionaryRef attachments = checked_cf_cast<CFMutableDictionaryRef>(CFArrayGetValueAtIndex(attachmentsArray, i));
+                CFDictionarySetValue(attachments, kCMSampleAttachmentKey_NotSync, kCFBooleanTrue);
+            }
+        }
 
         auto trackID = track.track_uid.value();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to