Log Message
SourceBuffer remove throws out way more content than requested https://bugs.webkit.org/show_bug.cgi?id=177884 <rdar://problem/34817104>
Reviewed by Darin Adler. Source/WebCore: Test: media/media-source/media-source-remove-too-much.html The end parameter is exclusive, not inclusive, of the range to be removed. * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::removeCodedFrames): LayoutTests: * media/media-source/media-source-remove-decodeorder-crash-expected.txt: * media/media-source/media-source-remove-decodeorder-crash.html: * media/media-source/media-source-remove-too-much-expected.txt: Added. * media/media-source/media-source-remove-too-much.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash-expected.txt
- trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash.html
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (223028 => 223029)
--- trunk/LayoutTests/ChangeLog 2017-10-08 07:47:43 UTC (rev 223028)
+++ trunk/LayoutTests/ChangeLog 2017-10-08 07:52:14 UTC (rev 223029)
@@ -1,3 +1,16 @@
+2017-10-08 Jer Noble <jer.no...@apple.com>
+
+ SourceBuffer remove throws out way more content than requested
+ https://bugs.webkit.org/show_bug.cgi?id=177884
+ <rdar://problem/34817104>
+
+ Reviewed by Darin Adler.
+
+ * media/media-source/media-source-remove-decodeorder-crash-expected.txt:
+ * media/media-source/media-source-remove-decodeorder-crash.html:
+ * media/media-source/media-source-remove-too-much-expected.txt: Added.
+ * media/media-source/media-source-remove-too-much.html: Added.
+
2017-10-08 Brent Fulgham <bfulg...@apple.com>
Nullptr deref in WebCore::Node::computeEditability
Modified: trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash-expected.txt (223028 => 223029)
--- trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash-expected.txt 2017-10-08 07:47:43 UTC (rev 223028)
+++ trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash-expected.txt 2017-10-08 07:52:14 UTC (rev 223029)
@@ -9,7 +9,7 @@
EVENT(updateend)
RUN(sourceBuffer.remove(1.9, 2))
EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '1') OK
+EXPECTED (sourceBuffer.buffered.length == '2') OK
EXPECTED (sourceBuffer.buffered.start(0) == '0') OK
EXPECTED (sourceBuffer.buffered.end(0) == '1') OK
END OF TEST
Modified: trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash.html (223028 => 223029)
--- trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash.html 2017-10-08 07:47:43 UTC (rev 223028)
+++ trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash.html 2017-10-08 07:52:14 UTC (rev 223029)
@@ -43,7 +43,7 @@
}
function checkRemoved() {
- testExpected('sourceBuffer.buffered.length', 1);
+ testExpected('sourceBuffer.buffered.length', 2);
testExpected('sourceBuffer.buffered.start(0)', 0);
testExpected('sourceBuffer.buffered.end(0)', 1);
endTest();
Added: trunk/LayoutTests/media/media-source/media-source-remove-too-much-expected.txt (0 => 223029)
--- trunk/LayoutTests/media/media-source/media-source-remove-too-much-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-remove-too-much-expected.txt 2017-10-08 07:52:14 UTC (rev 223029)
@@ -0,0 +1,14 @@
+This tests the SourceBuffer.remove() API. The test will remove samples from the given startTime (0) up to but not including the presentation start time of the sync sample (4) after endTime (4).
+
+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)
+RUN(sourceBuffer.remove(0, 4))
+EVENT(updateend)
+EXPECTED (sourceBuffer.buffered.start(0) == '4') OK
+END OF TEST
+
Copied: trunk/LayoutTests/media/media-source/media-source-remove-too-much.html (from rev 223028, trunk/LayoutTests/media/media-source/media-source-remove-decodeorder-crash.html) (0 => 223029)
--- trunk/LayoutTests/media/media-source/media-source-remove-too-much.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-remove-too-much.html 2017-10-08 07:52:14 UTC (rev 223029)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>mock-media-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ function runTest() {
+ findMediaElement();
+
+ source = new MediaSource();
+ waitForEventOn(source, 'sourceopen', sourceOpen);
+ run('video.src = ""
+ }
+
+ function sourceOpen() {
+ run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
+ waitForEventOn(sourceBuffer, 'updateend', loadSamples, false, true);
+ initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ run('sourceBuffer.appendBuffer(initSegment)');
+ }
+
+ function loadSamples() {
+ samples = concatenateSamples([
+ makeASample(0, 0, 1, 1, SAMPLE_FLAG.SYNC),
+ makeASample(1, 1, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(2, 2, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(3, 3, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(4, 4, 1, 1, SAMPLE_FLAG.SYNC),
+ makeASample(5, 5, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(6, 6, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(7, 7, 1, 1, SAMPLE_FLAG.NONE),
+ makeASample(8, 8, 1, 1, SAMPLE_FLAG.SYNC),
+ ]);
+ waitForEventOn(sourceBuffer, 'updateend', remove, false, true);
+ run('sourceBuffer.appendBuffer(samples)');
+ }
+
+ function remove() {
+ waitForEventOn(sourceBuffer, 'updateend', checkRemoved, false, true);
+ run('sourceBuffer.remove(0, 4)');
+ }
+
+ function checkRemoved() {
+ testExpected('sourceBuffer.buffered.start(0)', 4);
+ endTest();
+ }
+
+ </script>
+</head>
+<body _onload_="runTest()">
+ <div>This tests the SourceBuffer.remove() API. The test will remove samples from the given startTime (0) up to but not including the presentation start time of the sync sample (4) after endTime (4).</div>
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (223028 => 223029)
--- trunk/Source/WebCore/ChangeLog 2017-10-08 07:47:43 UTC (rev 223028)
+++ trunk/Source/WebCore/ChangeLog 2017-10-08 07:52:14 UTC (rev 223029)
@@ -1,3 +1,18 @@
+2017-10-08 Jer Noble <jer.no...@apple.com>
+
+ SourceBuffer remove throws out way more content than requested
+ https://bugs.webkit.org/show_bug.cgi?id=177884
+ <rdar://problem/34817104>
+
+ Reviewed by Darin Adler.
+
+ Test: media/media-source/media-source-remove-too-much.html
+
+ The end parameter is exclusive, not inclusive, of the range to be removed.
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::removeCodedFrames):
+
2017-10-08 Brent Fulgham <bfulg...@apple.com>
Nullptr deref in WebCore::Node::computeEditability
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (223028 => 223029)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2017-10-08 07:47:43 UTC (rev 223028)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2017-10-08 07:52:14 UTC (rev 223029)
@@ -760,7 +760,7 @@
divideSampleIfPossibleAtPresentationTime(end);
auto removePresentationStart = trackBuffer.samples.presentationOrder().findSampleContainingOrAfterPresentationTime(start);
- auto removePresentationEnd = trackBuffer.samples.presentationOrder().findSampleStartingAfterPresentationTime(end);
+ auto removePresentationEnd = trackBuffer.samples.presentationOrder().findSampleStartingOnOrAfterPresentationTime(end);
if (removePresentationStart == removePresentationEnd)
continue;
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes