Title: [264773] branches/safari-610.1.23.1-branch/Source/WebCore
Revision
264773
Author
repst...@apple.com
Date
2020-07-23 10:22:02 -0700 (Thu, 23 Jul 2020)

Log Message

Cherry-pick r264742. rdar://problem/65995985

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264742 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.23.1-branch/Source/WebCore/ChangeLog (264772 => 264773)


--- branches/safari-610.1.23.1-branch/Source/WebCore/ChangeLog	2020-07-23 17:15:13 UTC (rev 264772)
+++ branches/safari-610.1.23.1-branch/Source/WebCore/ChangeLog	2020-07-23 17:22:02 UTC (rev 264773)
@@ -1,3 +1,38 @@
+2020-07-23  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r264742. rdar://problem/65995985
+
+    [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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r264685. rdar://problem/65944676

Modified: branches/safari-610.1.23.1-branch/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (264772 => 264773)


--- branches/safari-610.1.23.1-branch/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-07-23 17:15:13 UTC (rev 264772)
+++ branches/safari-610.1.23.1-branch/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp	2020-07-23 17:22:02 UTC (rev 264773)
@@ -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