Title: [236258] trunk/Source/WebCore
- Revision
- 236258
- Author
- [email protected]
- Date
- 2018-09-20 07:08:18 -0700 (Thu, 20 Sep 2018)
Log Message
[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: trunk/Source/WebCore/ChangeLog (236257 => 236258)
--- trunk/Source/WebCore/ChangeLog 2018-09-20 11:49:55 UTC (rev 236257)
+++ trunk/Source/WebCore/ChangeLog 2018-09-20 14:08:18 UTC (rev 236258)
@@ -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-20 Yacine Bandou <[email protected]>
[EME] Add WebM sanitization
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (236257 => 236258)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2018-09-20 11:49:55 UTC (rev 236257)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2018-09-20 14:08:18 UTC (rev 236258)
@@ -1675,7 +1675,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