- Revision
- 176594
- Author
- [email protected]
- Date
- 2014-12-01 11:01:50 -0800 (Mon, 01 Dec 2014)
Log Message
[MSE] Unset timestamps of trackbuffers during Reset Parser State algorithm.
https://bugs.webkit.org/show_bug.cgi?id=139075.
Patch by Bartlomiej Gajda <[email protected]> on 2014-12-01
Reviewed by Jer Noble.
Source/WebCore:
Specification requires from us to unset timestamps for trackBuffers
during abort() method.
Test: media/media-source/media-source-append-nonsync-sample-after-abort.html
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::resetParserState):
(WebCore::SourceBuffer::abort):
* Modules/mediasource/SourceBuffer.h:
LayoutTests:
Specification requires from us to unset timestamps for trackBuffers during abort() method.
Tests appendBuffer() with first sync sample, then aborts after a few more samples, and emits
a few more non-sync samples, so they should be dropped, as trackBuffer will have
needRandomAccessFlag set.
* media/media-source/media-source-append-nonsync-sample-after-abort-expected.txt: Added.
* media/media-source/media-source-append-nonsync-sample-after-abort.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (176593 => 176594)
--- trunk/LayoutTests/ChangeLog 2014-12-01 18:42:52 UTC (rev 176593)
+++ trunk/LayoutTests/ChangeLog 2014-12-01 19:01:50 UTC (rev 176594)
@@ -1,3 +1,18 @@
+2014-12-01 Bartlomiej Gajda <[email protected]>
+
+ [MSE] Unset timestamps of trackbuffers during Reset Parser State algorithm.
+ https://bugs.webkit.org/show_bug.cgi?id=139075.
+
+ Reviewed by Jer Noble.
+
+ Specification requires from us to unset timestamps for trackBuffers during abort() method.
+ Tests appendBuffer() with first sync sample, then aborts after a few more samples, and emits
+ a few more non-sync samples, so they should be dropped, as trackBuffer will have
+ needRandomAccessFlag set.
+
+ * media/media-source/media-source-append-nonsync-sample-after-abort-expected.txt: Added.
+ * media/media-source/media-source-append-nonsync-sample-after-abort.html: Added.
+
2014-11-28 Andrzej Badowski <[email protected]>
[ATK] Allowing the use of AccessibilityUIElement::columnHeaders method for table.
Added: trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort-expected.txt (0 => 176594)
--- trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort-expected.txt 2014-12-01 19:01:50 UTC (rev 176594)
@@ -0,0 +1,9 @@
+
+RUN(video.src = ""
+RUN(quality = video.getVideoPlaybackQuality())
+EXPECTED (quality.droppedVideoFrames == '0') OK
+EXPECTED (video.duration == '4') OK
+RUN(quality = video.getVideoPlaybackQuality())
+EXPECTED (quality.droppedVideoFrames == '5') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort.html (0 => 176594)
--- trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-append-nonsync-sample-after-abort.html 2014-12-01 19:01:50 UTC (rev 176594)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>mock-media-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var quality;
+
+ var nextRequest = 0;
+ var sampleCount = 10;
+ var abortAfter = 4;
+ var droppedAmount = sampleCount - abortAfter - 1; // 1 sample will be aborted
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ function runTest() {
+ findMediaElement();
+ source = new MediaSource();
+ source.addEventListener('sourceopen', startLoad);
+ run('video.src = ""
+ }
+
+ function startLoad() {
+ sourceBuffer = source.addSourceBuffer('video/mock; codecs="mock"');
+ sourceBuffer.addEventListener('updateend', sourceUpdated);
+
+ run('quality = video.getVideoPlaybackQuality()');
+ testExpected('quality.droppedVideoFrames', 0);
+
+ // Make an init segment with 1 video track
+ var init = makeAInit(0, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ sourceBuffer.appendBuffer(init);
+ }
+
+ function sourceUpdated() {
+ if (nextRequest == sampleCount) {
+ finishTest();
+ return;
+ }
+
+ sourceBuffer.appendBuffer(
+ makeASample(nextRequest, nextRequest, 1, 1,
+ (nextRequest == 0) ? SAMPLE_FLAG.SYNC : SAMPLE_FLAG.NONE
+ ));
+
+ if (nextRequest == abortAfter)
+ sourceBuffer.abort();
+
+ ++nextRequest;
+ }
+
+ function finishTest() {
+ testExpected('video.duration', abortAfter);
+ run('quality = video.getVideoPlaybackQuality()');
+ testExpected('quality.droppedVideoFrames', droppedAmount);
+ endTest();
+ }
+ </script>
+</head>
+<body _onload_="runTest()">
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (176593 => 176594)
--- trunk/Source/WebCore/ChangeLog 2014-12-01 18:42:52 UTC (rev 176593)
+++ trunk/Source/WebCore/ChangeLog 2014-12-01 19:01:50 UTC (rev 176594)
@@ -1,3 +1,20 @@
+2014-12-01 Bartlomiej Gajda <[email protected]>
+
+ [MSE] Unset timestamps of trackbuffers during Reset Parser State algorithm.
+ https://bugs.webkit.org/show_bug.cgi?id=139075.
+
+ Reviewed by Jer Noble.
+
+ Specification requires from us to unset timestamps for trackBuffers
+ during abort() method.
+
+ Test: media/media-source/media-source-append-nonsync-sample-after-abort.html
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::resetParserState):
+ (WebCore::SourceBuffer::abort):
+ * Modules/mediasource/SourceBuffer.h:
+
2014-12-01 Chris Dumez <[email protected]>
Transform StyleBuilderCustom into a class and mark it as a friend of RenderStyle
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (176593 => 176594)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-12-01 18:42:52 UTC (rev 176593)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2014-12-01 19:01:50 UTC (rev 176594)
@@ -217,6 +217,33 @@
appendBufferInternal(static_cast<unsigned char*>(data->baseAddress()), data->byteLength(), ec);
}
+void SourceBuffer::resetParserState()
+{
+ // Section 3.5.2 Reset Parser State algorithm steps.
+ // http://www.w3.org/TR/2014/CR-media-source-20140717/#sourcebuffer-reset-parser-state
+ // 1. If the append state equals PARSING_MEDIA_SEGMENT and the input buffer contains some complete coded frames,
+ // then run the coded frame processing algorithm until all of these complete coded frames have been processed.
+ // FIXME: If any implementation will work in pulling mode (instead of async push to SourceBufferPrivate, and forget)
+ // this should be handled somehow either here, or in m_private->abort();
+
+ // 2. Unset the last decode timestamp on all track buffers.
+ // 3. Unset the last frame duration on all track buffers.
+ // 4. Unset the highest presentation timestamp on all track buffers.
+ // 5. Set the need random access point flag on all track buffers to true.
+ for (auto& trackBufferPair : m_trackBufferMap.values()) {
+ trackBufferPair.lastDecodeTimestamp = MediaTime::invalidTime();
+ trackBufferPair.lastFrameDuration = MediaTime::invalidTime();
+ trackBufferPair.highestPresentationTimestamp = MediaTime::invalidTime();
+ trackBufferPair.needRandomAccessFlag = true;
+ }
+ // 6. Remove all bytes from the input buffer.
+ // Note: this is handled by abortIfUpdating()
+ // 7. Set append state to WAITING_FOR_SEGMENT.
+ m_appendState = WaitingForSegment;
+
+ m_private->abort();
+}
+
void SourceBuffer::abort(ExceptionCode& ec)
{
// Section 3.2 abort() method steps.
@@ -234,7 +261,7 @@
abortIfUpdating();
// 4. Run the reset parser state algorithm.
- m_private->abort();
+ resetParserState();
// FIXME(229408) Add steps 5-6 update appendWindowStart & appendWindowEnd.
}
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (176593 => 176594)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2014-12-01 18:42:52 UTC (rev 176593)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2014-12-01 19:01:50 UTC (rev 176594)
@@ -153,6 +153,7 @@
void appendBufferInternal(unsigned char*, unsigned, ExceptionCode&);
void appendBufferTimerFired();
+ void resetParserState();
void setActive(bool);