[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

benm at google.com benm at google.com
Thu Oct 29 20:39:56 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 210900b1d0efb0db66ee12f93652ac10c5d84e2d
Author: benm at google.com <benm at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 6 11:08:54 2009 +0000

    Allow the platform media player to know the <video> poster URL.
    Add MediaPlayerPrivate::prepareToPlay() to support media engines
    that do not buffer video data automatically. This method allows
    such media engines to start the buffering just before starting
    playback.
    https://bugs.webkit.org/show_bug.cgi?id=29133
    
    Patch by Andrei Popescu <andreip at google.com> on 2009-10-05
    Reviewed by Eric Carlson.
    
    All platforms that currently implement <video> return false
    in MediaPlayerPrivate::canLoadPoster() and do nothing in
    MediaPlayerPrivate::prepareToPlay() their behavior is
    unchanged. The current set of media test should then be
    sufficient to guarantee that this patch does not break anything.
    
    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::loadResource):
    After the MediaPlayer is created, inform it what the poster URL is.
    (WebCore::HTMLMediaElement::updatePlayState):
    Add another case where prepareToPlay is called for the platforms
    that do not buffer video content automatically.
    (WebCore::HTMLMediaElement::couldPlayIfEnoughData)
    Same as potentiallyPlaying, except that we don't check for
    the readyState being at least HAVE_FUTURE_DATA.
    * platform/graphics/MediaPlayer.cpp:
    (WebCore::NullMediaPlayerPrivate::canLoadPoster):
    Empty implementation for the NullMediaPlayerPrivate.
    (WebCore::NullMediaPlayerPrivate::setPoster):
    Empty implementation for the NullMediaPlayerPrivate.
    (WebCore::MediaPlayer::canLoadPoster):
    Proxy to the m_private.
    (WebCore::MediaPlayer::setPoster):
    Proxy to m_private.
    * platform/graphics/MediaPlayer.h:
    * platform/graphics/MediaPlayerPrivate.h:
    (WebCore::MediaPlayerPrivateInterface::canLoadPoster):
    (WebCore::MediaPlayerPrivateInterface::setPoster):
    Add new methods that allow the platform player to receive the poster URL.
    (WebCore::MediaPlayerPrivateInterface::prepareToPlay):
    Notifies the media engine that playback should start. The media engine
    should start preparing (e.g. by initializing the player and starting to buffer)
    and call back when the state is changed to HAVE_FUTURE_DATA.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 99ebe4a..f446711 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,48 @@
+2009-10-05  Andrei Popescu  <andreip at google.com>
+
+        Reviewed by Eric Carlson.
+
+        Allow the platform media player to know the <video> poster URL.
+        Add MediaPlayerPrivate::prepareToPlay() to support media engines
+        that do not buffer video data automatically. This method allows
+        such media engines to start the buffering just before starting
+        playback.
+        https://bugs.webkit.org/show_bug.cgi?id=29133
+
+        All platforms that currently implement <video> return false
+        in MediaPlayerPrivate::canLoadPoster() and do nothing in
+        MediaPlayerPrivate::prepareToPlay() their behavior is
+        unchanged. The current set of media test should then be
+        sufficient to guarantee that this patch does not break anything.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::loadResource):
+        After the MediaPlayer is created, inform it what the poster URL is.
+        (WebCore::HTMLMediaElement::updatePlayState):
+        Add another case where prepareToPlay is called for the platforms
+        that do not buffer video content automatically.
+        (WebCore::HTMLMediaElement::couldPlayIfEnoughData)
+        Same as potentiallyPlaying, except that we don't check for
+        the readyState being at least HAVE_FUTURE_DATA.
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::NullMediaPlayerPrivate::canLoadPoster):
+        Empty implementation for the NullMediaPlayerPrivate.
+        (WebCore::NullMediaPlayerPrivate::setPoster):
+        Empty implementation for the NullMediaPlayerPrivate.
+        (WebCore::MediaPlayer::canLoadPoster):
+        Proxy to the m_private.
+        (WebCore::MediaPlayer::setPoster):
+        Proxy to m_private.
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::canLoadPoster):
+        (WebCore::MediaPlayerPrivateInterface::setPoster):
+        Add new methods that allow the platform player to receive the poster URL.
+        (WebCore::MediaPlayerPrivateInterface::prepareToPlay):
+        Notifies the media engine that playback should start. The media engine
+        should start preparing (e.g. by initializing the player and starting to buffer)
+        and call back when the state is changed to HAVE_FUTURE_DATA.
+
 2009-10-06  David Levin  <levin at chromium.org>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 10af15e..728ccdc 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -589,7 +589,13 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType)
     updateVolume();
 
     m_player->load(m_currentSrc, contentType);
-    
+
+    if (isVideo() && m_player->canLoadPoster()) {
+        KURL posterUrl = static_cast<HTMLVideoElement*>(this)->poster();
+        if (!posterUrl.isEmpty())
+            m_player->setPoster(posterUrl);
+    }
+
     if (renderer())
         renderer()->updateFromElement();
 }
@@ -1526,7 +1532,12 @@ PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const
 
 bool HTMLMediaElement::potentiallyPlaying() const
 {
-    return !paused() && m_readyState >= HAVE_FUTURE_DATA && !endedPlayback() && !stoppedDueToErrors() && !pausedForUserInteraction();
+    return m_readyState >= HAVE_FUTURE_DATA && couldPlayIfEnoughData();
+}
+
+bool HTMLMediaElement::couldPlayIfEnoughData() const
+{
+    return !paused() && !endedPlayback() && !stoppedDueToErrors() && !pausedForUserInteraction();
 }
 
 bool HTMLMediaElement::endedPlayback() const
@@ -1610,7 +1621,8 @@ void HTMLMediaElement::updatePlayState()
         float time = currentTime();
         if (time > m_lastSeekTime)
             addPlayedRange(m_lastSeekTime, time);
-    }
+    } else if (couldPlayIfEnoughData() && playerPaused)
+        m_player->prepareToPlay();
     
     if (renderer())
         renderer()->updateFromElement();
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index 2b0ce32..0005e07 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -241,6 +241,7 @@ private:
     bool endedPlayback() const;
     bool stoppedDueToErrors() const;
     bool pausedForUserInteraction() const;
+    bool couldPlayIfEnoughData() const;
 
     float minTimeSeekable() const;
     float maxTimeSeekable() const;
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 03dff91..3b32b65 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -62,6 +62,7 @@ public:
     virtual void load(const String&) { }
     virtual void cancelLoad() { }
     
+    virtual void prepareToPlay() { }
     virtual void play() { }
     virtual void pause() { }    
 
@@ -104,8 +105,10 @@ public:
 
     virtual void paint(GraphicsContext*, const IntRect&) { }
 
+    virtual bool canLoadPoster() const { return false; }
+    virtual void setPoster(const String&) { }
+
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-    virtual void setPoster(const String& /*url*/) { }
     virtual void deliverNotification(MediaPlayerProxyNotificationType) { }
     virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) { }
 #endif
@@ -253,18 +256,26 @@ void MediaPlayer::load(const String& url, const ContentType& contentType)
         m_private.set(createNullMediaPlayer(this));
 }    
 
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+bool MediaPlayer::canLoadPoster() const
+{
+    return m_private->canLoadPoster();
+}
+    
 void MediaPlayer::setPoster(const String& url)
 {
     m_private->setPoster(url);
 }    
-#endif
 
 void MediaPlayer::cancelLoad()
 {
     m_private->cancelLoad();
 }    
 
+void MediaPlayer::prepareToPlay()
+{
+    m_private->prepareToPlay();
+}
+    
 void MediaPlayer::play()
 {
     m_private->play();
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index 95efeb0..4cc6476 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -145,6 +145,7 @@ public:
     bool visible() const;
     void setVisible(bool);
     
+    void prepareToPlay();
     void play();
     void pause();    
     
@@ -204,8 +205,10 @@ public:
 
     MediaPlayerClient* mediaPlayerClient() const { return m_mediaPlayerClient; }
 
+    bool canLoadPoster() const;
+    void setPoster(const String&);
+
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-    void setPoster(const String& url);
     void deliverNotification(MediaPlayerProxyNotificationType notification);
     void setMediaPlayerProxy(WebMediaPlayerProxy* proxy);
 #endif
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index 2f220b1..f5687b3 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -43,6 +43,7 @@ public:
     virtual void load(const String& url) = 0;
     virtual void cancelLoad() = 0;
     
+    virtual void prepareToPlay() { }
     virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
 
     virtual void play() = 0;
@@ -95,8 +96,10 @@ public:
 
     virtual void setAutobuffer(bool) { };
 
+    virtual bool canLoadPoster() const { return false; }
+    virtual void setPoster(const String&) { }
+
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-    virtual void setPoster(const String& url) = 0;
     virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
     virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list