[GStreamer] create playbin in ::load(), not in player constructor
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2012 15:41:47 +0000 (15:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2012 15:41:47 +0000 (15:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103898

Patch by Víctor Manuel Jáquez Leal <vjaquez@igalia.com> on 2012-12-16
Reviewed by Philippe Normand.

This patch moves the instantiation of the playbin pipeline into the
WebCore::MediaPlayerPrivateGStreamer::load() method, so the pipeline
layout can reflect other predefined settings such as audio pitch
preservation in variable playback rate scenarios

No new tests. Covered by existing tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::load):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

index 759f7ff..2238551 100644 (file)
@@ -1,3 +1,23 @@
+2012-12-16  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
+
+        [GStreamer] create playbin in ::load(), not in player constructor
+        https://bugs.webkit.org/show_bug.cgi?id=103898
+
+        Reviewed by Philippe Normand.
+
+        This patch moves the instantiation of the playbin pipeline into the
+        WebCore::MediaPlayerPrivateGStreamer::load() method, so the pipeline
+        layout can reflect other predefined settings such as audio pitch
+        preservation in variable playback rate scenarios
+
+        No new tests. Covered by existing tests.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::load):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2012-12-16  Mihnea Ovidenie  <mihnea@adobe.com>
 
         [CSSRegions] Pseudo-elements should not be directly collected into a named flow
index dccee69..3e25579 100644 (file)
@@ -245,8 +245,6 @@ MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
     , m_totalBytes(-1)
     , m_originalPreloadWasAutoAndWasOverridden(false)
 {
-    if (initializeGStreamerAndRegisterWebKitElements())
-        createGSTPlayBin();
 }
 
 MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer()
@@ -293,6 +291,8 @@ MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer()
 
 void MediaPlayerPrivateGStreamer::load(const String& url)
 {
+    if (!initializeGStreamerAndRegisterWebKitElements())
+        return;
 
     KURL kurl(KURL(), url);
     String cleanUrl(url);
@@ -301,6 +301,13 @@ void MediaPlayerPrivateGStreamer::load(const String& url)
     if (kurl.isLocalFile())
         cleanUrl = cleanUrl.substring(0, kurl.pathEnd());
 
+    if (!m_playBin) {
+        createGSTPlayBin();
+        setDownloadBuffering();
+    }
+
+    ASSERT(m_playBin);
+
     m_url = KURL(KURL(), cleanUrl);
     g_object_set(m_playBin, "uri", cleanUrl.utf8().data(), NULL);
 
@@ -1744,13 +1751,10 @@ MediaPlayer::MovieLoadType MediaPlayerPrivateGStreamer::movieLoadType() const
     return MediaPlayer::Download;
 }
 
-void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
+void MediaPlayerPrivateGStreamer::setDownloadBuffering()
 {
-    m_originalPreloadWasAutoAndWasOverridden = m_preload != preload && m_preload == MediaPlayer::Auto;
-
-    m_preload = preload;
-
-    ASSERT(m_playBin);
+    if (!m_playBin)
+        return;
 
     GstPlayFlags flags;
     g_object_get(m_playBin, "flags", &flags, NULL);
@@ -1761,6 +1765,15 @@ void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
         LOG_MEDIA_MESSAGE("Disabling on-disk buffering");
         g_object_set(m_playBin, "flags", flags & ~GST_PLAY_FLAG_DOWNLOAD, NULL);
     }
+}
+
+void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
+{
+    m_originalPreloadWasAutoAndWasOverridden = m_preload != preload && m_preload == MediaPlayer::Auto;
+
+    m_preload = preload;
+
+    setDownloadBuffering();
 
     if (m_delayingLoad && m_preload != MediaPlayer::None) {
         m_delayingLoad = false;
index 59f528b..7bec143 100644 (file)
@@ -150,6 +150,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
             bool loadNextLocation();
             void mediaLocationChanged(GstMessage*);
 
+            void setDownloadBuffering();
             void processBufferingStats(GstMessage*);
 
             virtual String engineDescription() const { return "GStreamer"; }