Title: [156058] trunk
Revision
156058
Author
jer.no...@apple.com
Date
2013-09-18 13:33:11 -0700 (Wed, 18 Sep 2013)

Log Message

[MSE] Throw exception when setting timestampOffset while 'updating' state is set.
https://bugs.webkit.org/show_bug.cgi?id=121561

Reviewed by Eric Carlson.

Source/WebCore:

Tests: Updated http/tests/media/media-source/mediasource-append-buffer.html.

Merge https://chromium.googlesource.com/chromium/blink/+/25285998be3d0edcd951d12d445a7375e50e512c
by Changbin Shao.

The Media Source Extensions spec requires that an exception be thrown if the 'updating' attribute
equals true while setting the timestampOffset of a SourceBuffer.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::setTimestampOffset):

LayoutTests:

* http/tests/media/media-source/mediasource-append-buffer-expected.txt:
* http/tests/media/media-source/mediasource-append-buffer.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156057 => 156058)


--- trunk/LayoutTests/ChangeLog	2013-09-18 20:31:15 UTC (rev 156057)
+++ trunk/LayoutTests/ChangeLog	2013-09-18 20:33:11 UTC (rev 156058)
@@ -1,3 +1,13 @@
+2013-09-18  Jer Noble  <jer.no...@apple.com>
+
+        [MSE] Throw exception when setting timestampOffset while 'updating' state is set.
+        https://bugs.webkit.org/show_bug.cgi?id=121561
+
+        Reviewed by Eric Carlson.
+
+        * http/tests/media/media-source/mediasource-append-buffer-expected.txt:
+        * http/tests/media/media-source/mediasource-append-buffer.html:
+
 2013-09-18  Robert Hogan  <rob...@webkit.org>
 
         Quirksmode: Break Tag Extra Space Bug

Modified: trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt (156057 => 156058)


--- trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt	2013-09-18 20:31:15 UTC (rev 156057)
+++ trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer-expected.txt	2013-09-18 20:33:11 UTC (rev 156058)
@@ -4,6 +4,7 @@
 PASS Test SourceBuffer.abort() call during a pending appendBuffer(). 
 PASS Test SourceBuffer.appendBuffer() triggering an 'ended' to 'open' transition. 
 PASS Test MediaSource.removeSourceBuffer() call during a pending appendBuffer(). 
+PASS Test set SourceBuffer.timestampOffset during a pending appendBuffer(). 
 PASS Test appending an empty ArrayBufferView. 
 PASS Test appending an empty ArrayBuffer. 
 

Modified: trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html (156057 => 156058)


--- trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html	2013-09-18 20:31:15 UTC (rev 156057)
+++ trunk/LayoutTests/http/tests/media/media-source/mediasource-append-buffer.html	2013-09-18 20:33:11 UTC (rev 156058)
@@ -157,6 +157,27 @@
               });
           }, "Test MediaSource.removeSourceBuffer() call during a pending appendBuffer().");
 
+          mediasource_loaddata_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+          {
+              test.failOnEvent(mediaElement, 'error');
+
+              test.expectEvent(sourceBuffer, "updatestart", "Append started.");
+              test.expectEvent(sourceBuffer, "updateend", "Append ended.");
+              sourceBuffer.appendBuffer(mediaData);
+
+              assert_true(sourceBuffer.updating, "updating attribute is true");
+
+              assert_throws("InvalidStateError",
+                  function() { sourceBuffer.timestampOffset = 10.0; },
+                  "set timestampOffset throws an exception when updating attribute is true.");
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating attribute is false");
+                  test.done();
+              });
+          }, "Test set SourceBuffer.timestampOffset during a pending appendBuffer().");
+
           mediasource_test(function(test, mediaElement, mediaSource)
           {
               var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VIDEO_ONLY_TYPE);

Modified: trunk/Source/WebCore/ChangeLog (156057 => 156058)


--- trunk/Source/WebCore/ChangeLog	2013-09-18 20:31:15 UTC (rev 156057)
+++ trunk/Source/WebCore/ChangeLog	2013-09-18 20:33:11 UTC (rev 156058)
@@ -1,3 +1,21 @@
+2013-09-18  Jer Noble  <jer.no...@apple.com>
+
+        [MSE] Throw exception when setting timestampOffset while 'updating' state is set.
+        https://bugs.webkit.org/show_bug.cgi?id=121561
+
+        Reviewed by Eric Carlson.
+
+        Tests: Updated http/tests/media/media-source/mediasource-append-buffer.html.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/25285998be3d0edcd951d12d445a7375e50e512c
+        by Changbin Shao.
+
+        The Media Source Extensions spec requires that an exception be thrown if the 'updating' attribute
+        equals true while setting the timestampOffset of a SourceBuffer. 
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::setTimestampOffset):
+
 2013-09-18  Anders Carlsson  <ander...@apple.com>
 
         RefPtrHashMap should work with move only types

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (156057 => 156058)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2013-09-18 20:31:15 UTC (rev 156057)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2013-09-18 20:33:11 UTC (rev 156058)
@@ -96,6 +96,12 @@
         return;
     }
 
+    // 3. If the updating attribute equals true, then throw an INVALID_STATE_ERR exception and abort these steps.
+    if (m_updating) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
     // 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps:
     // 4.1 Set the readyState attribute of the parent media source to "open"
     // 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to