Diff
Modified: trunk/LayoutTests/ChangeLog (242128 => 242129)
--- trunk/LayoutTests/ChangeLog 2019-02-27 16:59:08 UTC (rev 242128)
+++ trunk/LayoutTests/ChangeLog 2019-02-27 17:31:46 UTC (rev 242129)
@@ -1,3 +1,14 @@
+2019-02-27 Ulrich Pflueger <[email protected]>
+
+ [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
+ https://bugs.webkit.org/show_bug.cgi?id=194747
+ <rdar://problem/48148469>
+
+ Reviewed by Jer Noble.
+
+ * media/media-source/media-source-append-variable-frame-lengths-with-matching-durations-expected.txt: Added.
+ * media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html: Added.
+
2019-02-26 Wenson Hsieh <[email protected]>
Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
Added: trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations-expected.txt (0 => 242129)
--- trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations-expected.txt 2019-02-27 17:31:46 UTC (rev 242129)
@@ -0,0 +1,15 @@
+This tests that variable frame lengths with matching frame durations will not be dropped.
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock"))
+RUN(sourceBuffer.appendBuffer(initSegment))
+EVENT(updateend)
+RUN(sourceBuffer.appendBuffer(samples))
+EVENT(updateend)
+EXPECTED (bufferedSamples.length == '3') OK
+{PTS({0/1000 = 0.000000}), DTS({0/1000 = 0.000000}), duration({10/1000 = 0.010000}), flags(1), generation(0)}
+{PTS({10/1000 = 0.010000}), DTS({10/1000 = 0.010000}), duration({30/1000 = 0.030000}), flags(0), generation(0)}
+{PTS({40/1000 = 0.040000}), DTS({40/1000 = 0.040000}), duration({10/1000 = 0.010000}), flags(0), generation(0)}
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html (0 => 242129)
--- trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html 2019-02-27 17:31:46 UTC (rev 242129)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>media-source-append-variable-frame-lengths-with-matching-durations</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ window.addEventListener('load', async event => {
+
+ findMediaElement();
+
+ source = new MediaSource();
+ run('video.src = ""
+ await waitFor(source, 'sourceopen');
+
+ run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
+ initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ run('sourceBuffer.appendBuffer(initSegment)');
+
+ await waitFor(sourceBuffer, 'updateend');
+
+ samples = concatenateSamples([
+ makeASample(0, 0, 10, 1000, 1, SAMPLE_FLAG.SYNC, 0),
+ makeASample(10, 10, 30, 1000, 1, SAMPLE_FLAG.NONE, 0),
+ makeASample(40, 40, 10, 1000, 1, SAMPLE_FLAG.NONE, 0)
+ ]);
+
+ run('sourceBuffer.appendBuffer(samples)');
+ await waitFor(sourceBuffer, 'updateend');
+
+ bufferedSamples = internals.bufferedSamplesForTrackID(sourceBuffer, 1);
+ testExpected("bufferedSamples.length", 3);
+ bufferedSamples.forEach(consoleWrite);
+ endTest();
+
+ }, {once: true});
+ </script>
+</head>
+<body>
+ <div>This tests that variable frame lengths with matching frame durations will not be dropped.</div>
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (242128 => 242129)
--- trunk/Source/WebCore/ChangeLog 2019-02-27 16:59:08 UTC (rev 242128)
+++ trunk/Source/WebCore/ChangeLog 2019-02-27 17:31:46 UTC (rev 242129)
@@ -1,3 +1,18 @@
+2019-02-27 Ulrich Pflueger <[email protected]>
+
+ [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
+ https://bugs.webkit.org/show_bug.cgi?id=194747
+ <rdar://problem/48148469>
+
+ Reviewed by Jer Noble.
+
+ Prevent unintended frame drops by including last frame duration in discontinuity check.
+
+ Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
+
2019-02-27 Timothy Hatcher <[email protected]>
REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (242128 => 242129)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2019-02-27 16:59:08 UTC (rev 242128)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2019-02-27 17:31:46 UTC (rev 242129)
@@ -1547,8 +1547,14 @@
// OR
// ↳ If last decode timestamp for track buffer is set and the difference between decode timestamp and
// last decode timestamp is greater than 2 times last frame duration:
+ MediaTime decodeDurationToCheck = trackBuffer.greatestDecodeDuration;
+
+ if (decodeDurationToCheck.isValid() && trackBuffer.lastFrameDuration.isValid()
+ && (trackBuffer.lastFrameDuration > decodeDurationToCheck))
+ decodeDurationToCheck = trackBuffer.lastFrameDuration;
+
if (trackBuffer.lastDecodeTimestamp.isValid() && (decodeTimestamp < trackBuffer.lastDecodeTimestamp
- || (trackBuffer.greatestDecodeDuration.isValid() && abs(decodeTimestamp - trackBuffer.lastDecodeTimestamp) > (trackBuffer.greatestDecodeDuration * 2)))) {
+ || (decodeDurationToCheck.isValid() && abs(decodeTimestamp - trackBuffer.lastDecodeTimestamp) > (decodeDurationToCheck * 2)))) {
// 1.6.1:
if (m_mode == AppendMode::Segments) {