Title: [236324] releases/WebKitGTK/webkit-2.22/Source/WebCore
Revision
236324
Author
[email protected]
Date
2018-09-21 10:04:06 -0700 (Fri, 21 Sep 2018)

Log Message

Merge r236258 - [MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
https://bugs.webkit.org/show_bug.cgi?id=189782

Reviewed by Xabier Rodriguez-Calvar.

Ideally, container formats should use exact timestamps and frames
should not overlap. Unfortunately, there are lots of files out there
where this is not always the case.

This is particularly a problem in WebM, where timestamps are expressed
in a power of 10 timescale, which forces some rounding.

This patch makes SourceBuffer allow frames with a small overlaps
(<=1ms) as those usually found in WebM. 1 ms is chosen because it's
the default time scale of WebM files.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (236323 => 236324)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-09-21 16:57:10 UTC (rev 236323)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog	2018-09-21 17:04:06 UTC (rev 236324)
@@ -1,3 +1,24 @@
+2018-09-20  Alicia Boya GarcĂ­a  <[email protected]>
+
+        [MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
+        https://bugs.webkit.org/show_bug.cgi?id=189782
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Ideally, container formats should use exact timestamps and frames
+        should not overlap. Unfortunately, there are lots of files out there
+        where this is not always the case.
+
+        This is particularly a problem in WebM, where timestamps are expressed
+        in a power of 10 timescale, which forces some rounding.
+
+        This patch makes SourceBuffer allow frames with a small overlaps
+        (<=1ms) as those usually found in WebM. 1 ms is chosen because it's
+        the default time scale of WebM files.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
+
 2018-09-11  Pablo Saavedra  <[email protected]>
 
         playbackControlsManagerUpdateTimerFired and

Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (236323 => 236324)


--- releases/WebKitGTK/webkit-2.22/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2018-09-21 16:57:10 UTC (rev 236323)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2018-09-21 17:04:06 UTC (rev 236324)
@@ -1610,7 +1610,17 @@
         // Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
         trackBuffer.samples.addSample(sample);
 
-        if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= trackBuffer.lastEnqueuedDecodeEndTime) {
+        // Note: The terminology here is confusing: "enqueuing" means providing a frame to the inner media framework.
+        // First, frames are inserted in the decode queue; later, at the end of the append all the frames in the decode
+        // queue are "enqueued" (sent to the inner media framework) in `provideMediaData()`.
+        //
+        // In order to check whether a frame should be added to the decode queue we check whether it starts after the
+        // lastEnqueuedDecodeEndTime or even a bit before that to accomodate files with imprecise timing information.
+        //
+        // There are many files out there where the frame times are not perfectly contiguous, therefore a tolerance is needed.
+        // For instance, most WebM files are muxed rounded to the millisecond (the default TimecodeScale of the format).
+        const MediaTime contiguousFrameTolerance = MediaTime(1, 1000);
+        if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= (trackBuffer.lastEnqueuedDecodeEndTime - contiguousFrameTolerance)) {
             DecodeOrderSampleMap::KeyType decodeKey(sample.decodeTime(), sample.presentationTime());
             trackBuffer.decodeQueue.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, &sample));
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to