Title: [223090] branches/safari-604-branch/Source/WebCore
Revision
223090
Author
[email protected]
Date
2017-10-09 17:07:45 -0700 (Mon, 09 Oct 2017)

Log Message

Cherry-pick r221116. rdar://problem/34771068

Modified Paths

Diff

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (223089 => 223090)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-10 00:07:42 UTC (rev 223089)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-10 00:07:45 UTC (rev 223090)
@@ -1,5 +1,24 @@
 2017-10-02  Jason Marcell  <[email protected]>
 
+        Cherry-pick r221116. rdar://problem/34771068
+
+    2017-08-23  Jer Noble  <[email protected]>
+
+            [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
+            https://bugs.webkit.org/show_bug.cgi?id=175901
+
+            Reviewed by Eric Carlson.
+
+            The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
+            regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
+            have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
+            times contains the timebase's current time.
+
+            * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+            (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
+
+2017-10-02  Jason Marcell  <[email protected]>
+
         Cherry-pick r220718. rdar://problem/34771041
 
     2017-08-14  Andy Estes  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm (223089 => 223090)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2017-10-10 00:07:42 UTC (rev 223089)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm	2017-10-10 00:07:45 UTC (rev 223090)
@@ -311,14 +311,20 @@
     if (m_timebase)
         CMTimebaseSetTimerDispatchSourceToFireImmediately(m_timebase.get(), m_timerSource.get());
 
-    if (m_hasAvailableFrameCallback) {
-        std::function<void()> callback { m_hasAvailableFrameCallback };
-        m_hasAvailableFrameCallback = nullptr;
-        RefPtr<WebCoreDecompressionSession> protectedThis { this };
-        dispatch_async(dispatch_get_main_queue(), [protectedThis, callback] {
-            callback();
-        });
+    if (!m_hasAvailableFrameCallback)
+        return;
+
+    if (m_timebase) {
+        auto currentTime = toMediaTime(CMTimebaseGetTime(m_timebase.get()));
+        auto presentationStartTime = toMediaTime(CMSampleBufferGetPresentationTimeStamp(sample));
+        auto presentationEndTime = presentationStartTime + toMediaTime(CMSampleBufferGetDuration(sample));
+        if (currentTime < presentationStartTime || currentTime >= presentationEndTime)
+            return;
     }
+
+    dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), callback = WTFMove(m_hasAvailableFrameCallback)] {
+        callback();
+    });
 }
 
 bool WebCoreDecompressionSession::isReadyForMoreMediaData() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to