Title: [144203] trunk
Revision
144203
Author
[email protected]
Date
2013-02-27 09:35:04 -0800 (Wed, 27 Feb 2013)

Log Message

Fix SourceBufferList so SourceBuffer.append() calls are always rejected after the MediaSource is closed.
https://bugs.webkit.org/show_bug.cgi?id=110917

Reviewed by Eric Carlson.

Source/WebCore:

Test: http/tests/media/media-source/video-media-source-reject-append-after-reopening.html

* Modules/mediasource/SourceBufferList.cpp:
(WebCore::SourceBufferList::clear):

LayoutTests:

* http/tests/media/media-source/video-media-source-reject-append-after-reopening-expected.txt: Added.
* http/tests/media/media-source/video-media-source-reject-append-after-reopening.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144202 => 144203)


--- trunk/LayoutTests/ChangeLog	2013-02-27 17:20:15 UTC (rev 144202)
+++ trunk/LayoutTests/ChangeLog	2013-02-27 17:35:04 UTC (rev 144203)
@@ -1,3 +1,13 @@
+2013-02-27  Aaron Colwell  <[email protected]>
+
+        Fix SourceBufferList so SourceBuffer.append() calls are always rejected after the MediaSource is closed.
+        https://bugs.webkit.org/show_bug.cgi?id=110917
+
+        Reviewed by Eric Carlson.
+
+        * http/tests/media/media-source/video-media-source-reject-append-after-reopening-expected.txt: Added.
+        * http/tests/media/media-source/video-media-source-reject-append-after-reopening.html: Added.
+
 2013-02-27  Ádám Kallai  <[email protected]>
 
         [Qt] Unreviewed gardening. Unskipp inspector tests after r144071.

Added: trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening-expected.txt (0 => 144203)


--- trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening-expected.txt	2013-02-27 17:35:04 UTC (rev 144203)
@@ -0,0 +1,12 @@
+Verify that append() calls on old SourceBuffers always fail when the MediaSource is closed and reopened.
+
+EVENT(webkitsourceopen)
+Adding SourceBuffers.
+Triggering MediaSource to close and reopen.
+EVENT(webkitsourceclose)
+EVENT(webkitsourceopen)
+Attempting to append to the old SourceBuffers.
+Got an exception while appending: InvalidStateError
+Got an exception while appending: InvalidStateError
+END OF TEST
+

Added: trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening.html (0 => 144203)


--- trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-source/video-media-source-reject-append-after-reopening.html	2013-02-27 17:35:04 UTC (rev 144203)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script src=""
+        <script>
+            var segmentHelper = new MediaSourceTest.SegmentHelper(WebMSegmentInfo.testWebM);
+
+            var sourceBuffer1;
+            var sourceBuffer2;
+            var isFirstOpen = true;
+
+            function tryToAppend(sourceBuffer)
+            {
+                try {
+                    sourceBuffer.append(segmentHelper.mediaSegments[0]);
+                } catch (e) {
+                    consoleWrite('Got an exception while appending: ' + e.name);
+                }
+            }
+
+            function onSourceOpen(event)
+            {
+                if (!isFirstOpen) {
+                   consoleWrite('Attempting to append to the old SourceBuffers.');
+                   tryToAppend(sourceBuffer1);
+                   tryToAppend(sourceBuffer2);
+                   endTest();
+                   return;
+                }
+
+                isFirstOpen = false;
+
+                consoleWrite('Adding SourceBuffers.');
+                sourceBuffer1 = mediaSource.addSourceBuffer('audio/webm; codecs="vorbis"');
+                sourceBuffer2 = mediaSource.addSourceBuffer('video/webm; codecs="vp8"');
+
+                consoleWrite('Triggering MediaSource to close and reopen.');
+                MediaSourceTest.setSrcToMediaSourceTestURL(video);
+            }
+
+            function onSourceClosed(event)
+            {
+                consoleWrite('onSourceOpen');
+            }
+
+            function onLoad()
+            {
+                findMediaElement();
+
+                mediaSource = new WebKitMediaSource();
+
+                waitForEventAndFail('error');
+                waitForEvent('webkitsourceopen', "", false, false, mediaSource);
+                waitForEvent('webkitsourceclose', "", false, false, mediaSource);
+                waitForEvent('webkitsourceended', "", false, false, mediaSource);
+                mediaSource.addEventListener('webkitsourceopen', onSourceOpen);
+
+                segmentHelper.init(video, function(success)
+                {
+                    if (!success) {
+                        failTest("Failed to load segment data");
+                        return;
+                    }
+
+                    MediaSourceTest.setSrcToMediaSourceTestURL(video);
+                });
+            }
+        </script>
+    </head>
+    <body _onload_="onLoad()">
+        <video autoplay> </video>
+        <p>Verify that append() calls on old SourceBuffers always fail when the MediaSource is closed and reopened.</p>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (144202 => 144203)


--- trunk/Source/WebCore/ChangeLog	2013-02-27 17:20:15 UTC (rev 144202)
+++ trunk/Source/WebCore/ChangeLog	2013-02-27 17:35:04 UTC (rev 144203)
@@ -1,3 +1,15 @@
+2013-02-27  Aaron Colwell  <[email protected]>
+
+        Fix SourceBufferList so SourceBuffer.append() calls are always rejected after the MediaSource is closed.
+        https://bugs.webkit.org/show_bug.cgi?id=110917
+
+        Reviewed by Eric Carlson.
+
+        Test: http/tests/media/media-source/video-media-source-reject-append-after-reopening.html
+
+        * Modules/mediasource/SourceBufferList.cpp:
+        (WebCore::SourceBufferList::clear):
+
 2013-02-27  Justin Novosad  <[email protected]>
 
         REGRESSION (r134631) of border-radius percentage with border pixel

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBufferList.cpp (144202 => 144203)


--- trunk/Source/WebCore/Modules/mediasource/SourceBufferList.cpp	2013-02-27 17:20:15 UTC (rev 144202)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBufferList.cpp	2013-02-27 17:35:04 UTC (rev 144203)
@@ -79,7 +79,9 @@
 void SourceBufferList::clear()
 {
     for (size_t i = 0; i < m_list.size(); ++i)
-        remove(m_list[i].get());
+        m_list[i]->clear();
+    m_list.clear();
+    createAndFireEvent(eventNames().webkitremovesourcebufferEvent);
 }
 
 String SourceBufferList::generateUniqueId()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to