WebCore:
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 18:24:59 +0000 (18:24 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 18:24:59 +0000 (18:24 +0000)
        Reviewed by Adam.

        If the media is playing and the load stalls the playback wont restart by seeking backwards.

        We should be in CAN_PLAY state if the current time is less than the maximum loaded time. Rate
        tricks were for streaming case and are not necessary now since that is now disabled.

        Windows patch coming separately.

        Test: http/tests/media/video-play-stall-seek.html

        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::updateStates):

LayoutTests:

        Reviewed by Adam.

        Test that playback can be resumed by seeking backwards after a stall.

        * http/tests/media/video-play-stall-seek-expected.txt: Added.
        * http/tests/media/video-play-stall-seek.html: Added.
        * platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29773 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/media/video-play-stall-seek-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/video-play-stall-seek.html [new file with mode: 0644]
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

index 974cbaa33cc86216713b90dfe8083bfc2abe6241..94ade135003d1429acf43de022de2c86a719d5b6 100644 (file)
@@ -1,3 +1,13 @@
+2008-01-23  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Adam.
+        
+        Test that playback can be resumed by seeking backwards after a stall.
+
+        * http/tests/media/video-play-stall-seek-expected.txt: Added.
+        * http/tests/media/video-play-stall-seek.html: Added.
+        * platform/win/Skipped:
+
 2008-01-15  Michael Goddard  <michael.goddard@trolltech.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/http/tests/media/video-play-stall-seek-expected.txt b/LayoutTests/http/tests/media/video-play-stall-seek-expected.txt
new file mode 100644 (file)
index 0000000..ead1e3e
--- /dev/null
@@ -0,0 +1,10 @@
+Test that playback can be resumed by seeking backwards after load stalls.
+
+EVENT(waiting)
+TEST(video.readyState == HTMLMediaElement.DATA_UNAVAILABLE) OK
+RUN(video.currentTime = 0.5)
+EVENT(canplay)
+TEST(video.readyState == HTMLMediaElement.CAN_PLAY) OK
+TEST(video.networkState == HTMLMediaElement.LOADED_FIRST_FRAME) OK
+END OF TEST
+
diff --git a/LayoutTests/http/tests/media/video-play-stall-seek.html b/LayoutTests/http/tests/media/video-play-stall-seek.html
new file mode 100644 (file)
index 0000000..e3e1168
--- /dev/null
@@ -0,0 +1,16 @@
+<video></video>
+<p>Test that playback can be resumed by seeking backwards after load stalls.</p>
+<script src=../../../media/video-test.js></script>
+<script>
+waitForEvent('waiting', function () {
+    waitForEvent('canplay' , function () {
+        test("video.readyState == HTMLMediaElement.CAN_PLAY");
+        test("video.networkState == HTMLMediaElement.LOADED_FIRST_FRAME");
+        endTest();
+    } );
+    test("video.readyState == HTMLMediaElement.DATA_UNAVAILABLE");
+    run("video.currentTime = 0.5");
+} );
+video.src = "http://127.0.0.1:8000/media/video-load-and-stall.cgi?name=../../../media/content/test.mp4&stallAt=80000";
+video.play();
+</script>
index e4e809a30fd4a8b454acdb86173b7cb273fa0304..da3333de4be9e86f284cc9a5d2e642d1d53645c5 100644 (file)
@@ -48,6 +48,7 @@ media/video-display-toggle.html
 # Fails, could be problem with the test setup <rdar://problem/5674282>
 http/tests/media/video-play-stall.html
 http/tests/media/video-seekable-stall.html
+http/tests/media/video-play-stall-seek.html
 
 # Fails <rdar://problem/5674289>
 media/video-seek-past-end-paused.html
index 05dfcf3b8e68418972f5d8962ca1ac6478c6d0cf..25dc07dfffd48f73b29a280cc826f7c2c11088fc 100644 (file)
@@ -1,3 +1,19 @@
+2008-01-24  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Adam.
+        
+        If the media is playing and the load stalls the playback wont restart by seeking backwards.
+        
+        We should be in CAN_PLAY state if the current time is less than the maximum loaded time. Rate 
+        tricks were for streaming case and are not necessary now since that is now disabled.
+        
+        Windows patch coming separately.
+
+        Test: http/tests/media/video-play-stall-seek.html
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivate::updateStates):
+
 2008-01-24  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Adam.
index b5095508ac38a15685efa9ef589a6e261794158b..bb23eadb9136df459ace09239d3ba26fdf3b968a 100644 (file)
@@ -163,7 +163,7 @@ void MediaPlayerPrivate::createQTMovie(const String& url)
     
     m_qtMovie = 0;
     
-    // Disable streaming support for now
+    // Disable streaming support for now, <rdar://problem/5693967>
     if (url.startsWith("rtsp:"))
         return;
     
@@ -551,11 +551,12 @@ void MediaPlayerPrivate::updateStates()
     } else if (loadState >= QTMovieLoadStatePlaythroughOK) {
         if (m_networkState < MediaPlayer::LoadedFirstFrame && !seeking())
             m_networkState = MediaPlayer::LoadedFirstFrame;
-        m_readyState = ([m_qtMovie.get() rate] == 0 && m_startedPlaying) ? MediaPlayer::DataUnavailable : MediaPlayer::CanPlayThrough;
+        m_readyState = MediaPlayer::CanPlayThrough;
     } else if (loadState >= QTMovieLoadStatePlayable) {
         if (m_networkState < MediaPlayer::LoadedFirstFrame && !seeking())
             m_networkState = MediaPlayer::LoadedFirstFrame;
-        m_readyState = ([m_qtMovie.get() rate] == 0 && m_startedPlaying) ? MediaPlayer::DataUnavailable : MediaPlayer::CanPlay;
+        // FIXME: This might not work correctly in streaming case, <rdar://problem/5693967>
+        m_readyState = currentTime() < maxTimeLoaded() ? MediaPlayer::CanPlay : MediaPlayer::DataUnavailable;
     } else if (loadState >= QTMovieLoadStateLoaded) {
         if (m_networkState < MediaPlayer::LoadedMetaData)
             m_networkState = MediaPlayer::LoadedMetaData;