[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

vestbo at webkit.org vestbo at webkit.org
Wed Dec 22 13:10:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a2aa599c304ddac938b2aef53facbd4ad86fc907
Author: vestbo at webkit.org <vestbo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 8 09:18:27 2010 +0000

    Add mediaPlayerPlaybackStateChanged to MediaPlayerClient
    
    Reviewed by Eric Carlson.
    
    https://bugs.webkit.org/show_bug.cgi?id=45263
    
    The platform backend may change state, for example as a result
    of an external plugin controlling the backend, so we need to
    react to this situation by syncing up the WebCore state with the
    platform backend.
    
    We call playInternal()/pauseInternal() depending on the backend
    state, to trigger the corresponding DOM events to match the state.
    
    updatePlayState() is then refactored to take into account the
    situation where the backend is already in the correct state but
    WebCore is not, so that we update the playback progress timer
    and set m_playing correctly.
    
    updatePlayState() changes Should be covered by existing tests.
    
    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
    (WebCore::HTMLMediaElement::updatePlayState):
    * html/HTMLMediaElement.h:
    * platform/graphics/MediaPlayer.cpp:
    (WebCore::MediaPlayer::playbackStateChanged):
    * platform/graphics/MediaPlayer.h:
    (WebCore::MediaPlayerClient::mediaPlayerPlaybackStateChanged):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66961 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c917833..0368246 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-09-06  Tor Arne Vestbø  <tor.arne.vestbo at nokia.com>
+
+        Reviewed by Eric Carlson.
+
+        Add mediaPlayerPlaybackStateChanged to MediaPlayerClient
+
+        https://bugs.webkit.org/show_bug.cgi?id=45263
+
+        The platform backend may change state, for example as a result
+        of an external plugin controlling the backend, so we need to
+        react to this situation by syncing up the WebCore state with the
+        platform backend.
+
+        We call playInternal()/pauseInternal() depending on the backend
+        state, to trigger the corresponding DOM events to match the state.
+
+        updatePlayState() is then refactored to take into account the
+        situation where the backend is already in the correct state but
+        WebCore is not, so that we update the playback progress timer
+        and set m_playing correctly.
+
+        updatePlayState() changes Should be covered by existing tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
+        (WebCore::HTMLMediaElement::updatePlayState):
+        * html/HTMLMediaElement.h:
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::playbackStateChanged):
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayerClient::mediaPlayerPlaybackStateChanged):
+
 2010-09-08  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 9e4d32f..9c2c15c 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -1600,6 +1600,19 @@ void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*)
     endProcessingMediaPlayerCallback();
 }
 
+void HTMLMediaElement::mediaPlayerPlaybackStateChanged(MediaPlayer*)
+{
+    if (!m_player)
+        return;
+
+    beginProcessingMediaPlayerCallback();
+    if (m_player->paused())
+        pauseInternal();
+    else
+        playInternal();
+    endProcessingMediaPlayerCallback();
+}
+
 void HTMLMediaElement::mediaPlayerSawUnsupportedTracks(MediaPlayer*)
 {
     // The MediaPlayer came across content it cannot completely handle.
@@ -1775,24 +1788,33 @@ void HTMLMediaElement::updatePlayState()
     
     bool shouldBePlaying = potentiallyPlaying();
     bool playerPaused = m_player->paused();
-    if (shouldBePlaying && playerPaused) {
+
+    if (shouldBePlaying) {
         setDisplayMode(Video);
 
-        // Set rate before calling play in case the rate was set before the media engine wasn't setup.
-        // The media engine should just stash the rate since it isn't already playing.
-        m_player->setRate(m_playbackRate);
-        m_player->play();
+        if (playerPaused) {
+            // Set rate before calling play in case the rate was set before the media engine was setup.
+            // The media engine should just stash the rate since it isn't already playing.
+            m_player->setRate(m_playbackRate);
+            m_player->play();
+        }
+
         startPlaybackProgressTimer();
         m_playing = true;
-    } else if (!shouldBePlaying && !playerPaused) {
-        m_player->pause();
+
+    } else { // Should not be playing right now
+        if (!playerPaused)
+            m_player->pause();
+
         m_playbackProgressTimer.stop();
         m_playing = false;
         float time = currentTime();
         if (time > m_lastSeekTime)
             addPlayedRange(m_lastSeekTime, time);
-    } else if (couldPlayIfEnoughData() && playerPaused)
-        m_player->prepareToPlay();
+
+        if (couldPlayIfEnoughData())
+            m_player->prepareToPlay();
+    }
     
     if (renderer())
         renderer()->updateFromElement();
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index 0a8f8dd..adea0fd 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -219,6 +219,7 @@ private:
     virtual void mediaPlayerMuteChanged(MediaPlayer*);
     virtual void mediaPlayerDurationChanged(MediaPlayer*);
     virtual void mediaPlayerRateChanged(MediaPlayer*);
+    virtual void mediaPlayerPlaybackStateChanged(MediaPlayer*);
     virtual void mediaPlayerSawUnsupportedTracks(MediaPlayer*);
     virtual void mediaPlayerRepaint(MediaPlayer*);
     virtual void mediaPlayerSizeChanged(MediaPlayer*);
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 94c7e14..5ae5f55 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -694,6 +694,12 @@ void MediaPlayer::rateChanged()
         m_mediaPlayerClient->mediaPlayerRateChanged(this);
 }
 
+void MediaPlayer::playbackStateChanged()
+{
+    if (m_mediaPlayerClient)
+        m_mediaPlayerClient->mediaPlayerPlaybackStateChanged(this);
+}
+
 }
 
 #endif
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index 0bebf52..c2d0a00 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -121,6 +121,9 @@ public:
     // the playback rate has changed
     virtual void mediaPlayerRateChanged(MediaPlayer*) { }
 
+    // the play/pause status changed
+    virtual void mediaPlayerPlaybackStateChanged(MediaPlayer*) { }
+
     // The MediaPlayer has found potentially problematic media content.
     // This is used internally to trigger swapping from a <video>
     // element to an <embed> in standalone documents
@@ -241,6 +244,7 @@ public:
     void timeChanged();
     void sizeChanged();
     void rateChanged();
+    void playbackStateChanged();
     void durationChanged();
 
     void repaint();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list