Title: [140414] trunk/Source/WebCore
Revision
140414
Author
[email protected]
Date
2013-01-22 04:55:22 -0800 (Tue, 22 Jan 2013)

Log Message

[gstreamer] MediaPlayerPrivateGStreamer should take ownership of the playbin
https://bugs.webkit.org/show_bug.cgi?id=107445

Reviewed by Philippe Normand.

In gstreamer 1.0, gst_element_factory_make() now returns a floating reference.
MediaPlayerPrivateGStreamer calls gst_element_factory_make() to create the
playbin object but does not take ownership of the object. As a consequence,
the object keeps floating until it is unref'd in the
MediaPlayerPrivateGStreamer destructor.

This patch uses a GRefPtr<GstElement> to store the playbin object and only
adopt the object returned by gst_element_factory_make() if gstreamer 0.10
is used. When gstreamer 1.0 is used, the returned object will not be adopted,
which will remove the floating reference. This way, we ensure that the
playbin object is owned by MediaPlayerPrivateGStreamer.

No new tests, no behavior change for layout tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::load):
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamer::duration):
(WebCore::MediaPlayerPrivateGStreamer::seek):
(WebCore::MediaPlayerPrivateGStreamer::paused):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
(WebCore::MediaPlayerPrivateGStreamer::setVolume):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange):
(WebCore::MediaPlayerPrivateGStreamer::setRate):
(WebCore::MediaPlayerPrivateGStreamer::buffered):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
(WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140413 => 140414)


--- trunk/Source/WebCore/ChangeLog	2013-01-22 12:46:03 UTC (rev 140413)
+++ trunk/Source/WebCore/ChangeLog	2013-01-22 12:55:22 UTC (rev 140414)
@@ -1,3 +1,44 @@
+2013-01-22  Christophe Dumez  <[email protected]>
+
+        [gstreamer] MediaPlayerPrivateGStreamer should take ownership of the playbin
+        https://bugs.webkit.org/show_bug.cgi?id=107445
+
+        Reviewed by Philippe Normand.
+
+        In gstreamer 1.0, gst_element_factory_make() now returns a floating reference.
+        MediaPlayerPrivateGStreamer calls gst_element_factory_make() to create the
+        playbin object but does not take ownership of the object. As a consequence,
+        the object keeps floating until it is unref'd in the
+        MediaPlayerPrivateGStreamer destructor.
+
+        This patch uses a GRefPtr<GstElement> to store the playbin object and only
+        adopt the object returned by gst_element_factory_make() if gstreamer 0.10
+        is used. When gstreamer 1.0 is used, the returned object will not be adopted,
+        which will remove the floating reference. This way, we ensure that the
+        playbin object is owned by MediaPlayerPrivateGStreamer.
+
+        No new tests, no behavior change for layout tests.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::load):
+        (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
+        (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
+        (WebCore::MediaPlayerPrivateGStreamer::duration):
+        (WebCore::MediaPlayerPrivateGStreamer::seek):
+        (WebCore::MediaPlayerPrivateGStreamer::paused):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
+        (WebCore::MediaPlayerPrivateGStreamer::setVolume):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange):
+        (WebCore::MediaPlayerPrivateGStreamer::setRate):
+        (WebCore::MediaPlayerPrivateGStreamer::buffered):
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
+        (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2013-01-22  Yury Semikhatsky  <[email protected]>
 
         Unreviewed. Fix closure compiler warning in inspector front-end after r140390.

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (140413 => 140414)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2013-01-22 12:46:03 UTC (rev 140413)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2013-01-22 12:55:22 UTC (rev 140414)
@@ -212,7 +212,6 @@
 
 MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
     : m_player(player)
-    , m_playBin(0)
     , m_webkitVideoSink(0)
     , m_fpsSink(0)
     , m_source(0)
@@ -276,8 +275,7 @@
 #endif
 
     if (m_playBin) {
-        gst_element_set_state(m_playBin, GST_STATE_NULL);
-        gst_object_unref(GST_OBJECT(m_playBin));
+        gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
         m_playBin = 0;
     }
 
@@ -316,7 +314,7 @@
     ASSERT(m_playBin);
 
     m_url = KURL(KURL(), cleanUrl);
-    g_object_set(m_playBin, "uri", cleanUrl.utf8().data(), NULL);
+    g_object_set(m_playBin.get(), "uri", cleanUrl.utf8().data(), NULL);
 
     LOG_MEDIA_MESSAGE("Load %s", cleanUrl.utf8().data());
 
@@ -335,7 +333,7 @@
 
     // GStreamer needs to have the pipeline set to a paused state to
     // start providing anything useful.
-    gst_element_set_state(m_playBin, GST_STATE_PAUSED);
+    gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
 
     if (!m_delayingLoad)
         commitLoad();
@@ -364,7 +362,7 @@
     float ret = 0.0f;
 
     GstQuery* query = gst_query_new_position(GST_FORMAT_TIME);
-    if (!gst_element_query(m_playBin, query)) {
+    if (!gst_element_query(m_playBin.get(), query)) {
         LOG_MEDIA_MESSAGE("Position query failed...");
         gst_query_unref(query);
         return ret;
@@ -392,12 +390,12 @@
     GstState currentState;
     GstState pending;
 
-    gst_element_get_state(m_playBin, &currentState, &pending, 0);
+    gst_element_get_state(m_playBin.get(), &currentState, &pending, 0);
     LOG_MEDIA_MESSAGE("Current state: %s, pending: %s", gst_element_state_get_name(currentState), gst_element_state_get_name(pending));
     if (currentState == newState || pending == newState)
         return true;
 
-    GstStateChangeReturn setStateResult = gst_element_set_state(m_playBin, newState);
+    GstStateChangeReturn setStateResult = gst_element_set_state(m_playBin.get(), newState);
     GstState pausedOrPlaying = newState == GST_STATE_PLAYING ? GST_STATE_PAUSED : GST_STATE_PLAYING;
     if (currentState != pausedOrPlaying && setStateResult == GST_STATE_CHANGE_FAILURE) {
         loadingFailed(MediaPlayer::Empty);
@@ -453,9 +451,9 @@
     gint64 timeLength = 0;
 
 #ifdef GST_API_VERSION_1
-    bool failure = !gst_element_query_duration(m_playBin, timeFormat, &timeLength) || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE;
+    bool failure = !gst_element_query_duration(m_playBin.get(), timeFormat, &timeLength) || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE;
 #else
-    bool failure = !gst_element_query_duration(m_playBin, &timeFormat, &timeLength) || timeFormat != GST_FORMAT_TIME || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE;
+    bool failure = !gst_element_query_duration(m_playBin.get(), &timeFormat, &timeLength) || timeFormat != GST_FORMAT_TIME || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE;
 #endif
     if (failure) {
         LOG_MEDIA_MESSAGE("Time duration query failed for %s", m_url.string().utf8().data());
@@ -518,7 +516,7 @@
     GstClockTime clockTime = GST_TIMEVAL_TO_TIME(timeValue);
     LOG_MEDIA_MESSAGE("Seek: %" GST_TIME_FORMAT, GST_TIME_ARGS(clockTime));
 
-    if (!gst_element_seek(m_playBin, m_player->rate(),
+    if (!gst_element_seek(m_playBin.get(), m_player->rate(),
             GST_FORMAT_TIME,
             (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
             GST_SEEK_TYPE_SET, clockTime,
@@ -538,7 +536,7 @@
     }
 
     GstState state;
-    gst_element_get_state(m_playBin, &state, 0, 0);
+    gst_element_get_state(m_playBin.get(), &state, 0, 0);
     return state == GST_STATE_PAUSED;
 }
 
@@ -620,7 +618,7 @@
 
     gint videoTracks = 0;
     if (m_playBin)
-        g_object_get(m_playBin, "n-video", &videoTracks, NULL);
+        g_object_get(m_playBin.get(), "n-video", &videoTracks, NULL);
 
     m_hasVideo = videoTracks > 0;
 
@@ -642,7 +640,7 @@
 
     gint audioTracks = 0;
     if (m_playBin)
-        g_object_get(m_playBin, "n-audio", &audioTracks, NULL);
+        g_object_get(m_playBin.get(), "n-audio", &audioTracks, NULL);
     m_hasAudio = audioTracks > 0;
     m_player->mediaPlayerClient()->mediaPlayerEngineUpdated(m_player);
 }
@@ -652,7 +650,7 @@
     if (!m_playBin)
         return;
 
-    gst_stream_volume_set_volume(GST_STREAM_VOLUME(m_playBin), GST_STREAM_VOLUME_FORMAT_CUBIC,
+    gst_stream_volume_set_volume(GST_STREAM_VOLUME(m_playBin.get()), GST_STREAM_VOLUME_FORMAT_CUBIC,
                                  static_cast<double>(volume));
 }
 
@@ -663,7 +661,7 @@
     if (!m_player || !m_playBin)
         return;
     double volume;
-    volume = gst_stream_volume_get_volume(GST_STREAM_VOLUME(m_playBin), GST_STREAM_VOLUME_FORMAT_CUBIC);
+    volume = gst_stream_volume_get_volume(GST_STREAM_VOLUME(m_playBin.get()), GST_STREAM_VOLUME_FORMAT_CUBIC);
     // get_volume() can return values superior to 1.0 if the user
     // applies software user gain via third party application (GNOME
     // volume control for instance).
@@ -687,7 +685,7 @@
     GstState state;
     GstState pending;
 
-    gst_element_get_state(m_playBin, &state, &pending, 0);
+    gst_element_get_state(m_playBin.get(), &state, &pending, 0);
     if ((state != GST_STATE_PLAYING && state != GST_STATE_PAUSED)
         || (pending == GST_STATE_PAUSED))
         return;
@@ -699,7 +697,7 @@
     m_changingRate = true;
 
     if (!rate) {
-        gst_element_set_state(m_playBin, GST_STATE_PAUSED);
+        gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
         return;
     }
 
@@ -729,12 +727,12 @@
 
     LOG_MEDIA_MESSAGE("Need to mute audio: %d", (int) mute);
 
-    if (!gst_element_seek(m_playBin, rate, GST_FORMAT_TIME, flags,
+    if (!gst_element_seek(m_playBin.get(), rate, GST_FORMAT_TIME, flags,
                           GST_SEEK_TYPE_SET, start,
                           GST_SEEK_TYPE_SET, end))
         LOG_MEDIA_MESSAGE("Set rate to %f failed", rate);
     else
-        g_object_set(m_playBin, "mute", mute, NULL);
+        g_object_set(m_playBin.get(), "mute", mute, NULL);
 }
 
 MediaPlayer::NetworkState MediaPlayerPrivateGStreamer::networkState() const
@@ -760,7 +758,7 @@
 
     GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT);
 
-    if (!gst_element_query(m_playBin, query)) {
+    if (!gst_element_query(m_playBin.get(), query)) {
         gst_query_unref(query);
         return timeRanges.release();
     }
@@ -815,7 +813,7 @@
         gst_message_parse_error(message, &err.outPtr(), &debug.outPtr());
         LOG_MEDIA_MESSAGE("Error %d: %s (url="" err->code, err->message, m_url.string().utf8().data());
 
-        GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_playBin), GST_DEBUG_GRAPH_SHOW_ALL, "webkit-video.error");
+        GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_playBin.get()), GST_DEBUG_GRAPH_SHOW_ALL, "webkit-video.error");
 
         error = MediaPlayer::Empty;
         if (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND
@@ -856,7 +854,7 @@
 
         // Ignore state changes from internal elements. They are
         // forwarded to playbin2 anyway.
-        if (GST_MESSAGE_SRC(message) == reinterpret_cast<GstObject*>(m_playBin)) {
+        if (GST_MESSAGE_SRC(message) == reinterpret_cast<GstObject*>(m_playBin.get())) {
             updateStates();
 
             // Construct a filename for the graphviz dot file output.
@@ -867,7 +865,7 @@
                                                  gst_element_state_get_name(oldState),
                                                  gst_element_state_get_name(newState)).utf8();
 
-            GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_playBin), GST_DEBUG_GRAPH_SHOW_ALL, dotFileName.data());
+            GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(m_playBin.get()), GST_DEBUG_GRAPH_SHOW_ALL, dotFileName.data());
         }
         break;
     case GST_MESSAGE_BUFFERING:
@@ -924,7 +922,7 @@
 {
     GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT);
 
-    if (!gst_element_query(m_playBin, query)) {
+    if (!gst_element_query(m_playBin.get(), query)) {
         gst_query_unref(query);
         return;
     }
@@ -1123,7 +1121,7 @@
 
     GstElement* sinkPtr = 0;
 
-    g_object_get(m_playBin, "audio-sink", &sinkPtr, NULL);
+    g_object_get(m_playBin.get(), "audio-sink", &sinkPtr, NULL);
     m_webkitAudioSink = adoptGRef(sinkPtr);
 
 }
@@ -1133,7 +1131,7 @@
 {
     GstElement* srcPtr = 0;
 
-    g_object_get(m_playBin, "source", &srcPtr, NULL);
+    g_object_get(m_playBin.get(), "source", &srcPtr, NULL);
     m_source = adoptGRef(srcPtr);
 
     if (WEBKIT_IS_WEB_SRC(m_source.get()))
@@ -1146,7 +1144,7 @@
         return;
 
     if (m_playBin)
-        gst_element_set_state(m_playBin, GST_STATE_NULL);
+        gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
 }
 
 void MediaPlayerPrivateGStreamer::updateStates()
@@ -1162,7 +1160,7 @@
     GstState state;
     GstState pending;
 
-    GstStateChangeReturn ret = gst_element_get_state(m_playBin,
+    GstStateChangeReturn ret = gst_element_get_state(m_playBin.get(),
         &state, &pending, 250 * GST_NSECOND);
 
     bool shouldUpdateAfterSeek = false;
@@ -1218,7 +1216,7 @@
 
                 if (!m_paused) {
                     LOG_MEDIA_MESSAGE("[Buffering] Restarting playback.");
-                    gst_element_set_state(m_playBin, GST_STATE_PLAYING);
+                    gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
                 }
             } else if (!m_buffering && (currentTime() < duration())) {
                 m_paused = true;
@@ -1233,7 +1231,7 @@
 
                 LOG_MEDIA_MESSAGE("[Buffering] Pausing stream for buffering.");
 
-                gst_element_set_state(m_playBin, GST_STATE_PAUSED);
+                gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
             }
         } else
             m_paused = true;
@@ -1264,14 +1262,14 @@
         // pipeline.
         if (state == GST_STATE_READY && isLiveStream() && m_preload == MediaPlayer::Auto) {
             setPreload(MediaPlayer::None);
-            gst_element_set_state(m_playBin, GST_STATE_NULL);
-            gst_element_set_state(m_playBin, GST_STATE_PAUSED);
+            gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
+            gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
         }
 
         // A live stream was paused, reset the pipeline.
         if (state == GST_STATE_PAUSED && pending == GST_STATE_PLAYING && isLiveStream()) {
-            gst_element_set_state(m_playBin, GST_STATE_NULL);
-            gst_element_set_state(m_playBin, GST_STATE_PLAYING);
+            gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
+            gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
         }
 
         if (!isLiveStream() && !m_buffering)
@@ -1307,9 +1305,9 @@
             shouldUpdateAfterSeek = true;
             m_seeking = false;
             if (!m_paused)
-                gst_element_set_state(m_playBin, GST_STATE_PLAYING);
+                gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
         } else if (!m_paused)
-            gst_element_set_state(m_playBin, GST_STATE_PLAYING);
+            gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
 
         m_networkState = MediaPlayer::Loading;
         break;
@@ -1395,7 +1393,7 @@
         // append the value of new-location to it.
 
         gchar* currentLocation = 0;
-        g_object_get(m_playBin, "uri", &currentLocation, NULL);
+        g_object_get(m_playBin.get(), "uri", &currentLocation, NULL);
 
         KURL currentUrl(KURL(), currentLocation);
         g_free(currentLocation);
@@ -1419,14 +1417,14 @@
 
             // Reset pipeline state.
             m_resetPipeline = true;
-            gst_element_set_state(m_playBin, GST_STATE_READY);
+            gst_element_set_state(m_playBin.get(), GST_STATE_READY);
 
             GstState state;
-            gst_element_get_state(m_playBin, &state, 0, 0);
+            gst_element_get_state(m_playBin.get(), &state, 0, 0);
             if (state <= GST_STATE_READY) {
                 // Set the new uri and start playing.
-                g_object_set(m_playBin, "uri", newUrl.string().utf8().data(), NULL);
-                gst_element_set_state(m_playBin, GST_STATE_PLAYING);
+                g_object_set(m_playBin.get(), "uri", newUrl.string().utf8().data(), NULL);
+                gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
                 return true;
             }
         }
@@ -1469,7 +1467,7 @@
 
     if (!m_player->mediaPlayerClient()->mediaPlayerIsLooping()) {
         m_paused = true;
-        gst_element_set_state(m_playBin, GST_STATE_NULL);
+        gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
     }
 }
 
@@ -1480,7 +1478,7 @@
 
     // And re-cache it if possible.
     GstState state;
-    gst_element_get_state(m_playBin, &state, 0, 0);
+    gst_element_get_state(m_playBin.get(), &state, 0, 0);
     float newDuration = duration();
 
     if (state <= GST_STATE_READY) {
@@ -1514,8 +1512,8 @@
         m_totalBytes = -1;
         if (totalBytes() && !isLiveStream()) {
             setPreload(MediaPlayer::Auto);
-            gst_element_set_state(m_playBin, GST_STATE_NULL);
-            gst_element_set_state(m_playBin, GST_STATE_PAUSED);
+            gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
+            gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
         }
     }
 }
@@ -1530,7 +1528,7 @@
     if (!m_playBin)
         return;
 
-    g_object_set(m_playBin, "mute", muted, NULL);
+    g_object_set(m_playBin.get(), "mute", muted, NULL);
 }
 
 void MediaPlayerPrivateGStreamer::notifyPlayerOfMute()
@@ -1541,7 +1539,7 @@
         return;
 
     gboolean muted;
-    g_object_get(m_playBin, "mute", &muted, NULL);
+    g_object_get(m_playBin.get(), "mute", &muted, NULL);
     m_player->muteChanged(static_cast<bool>(muted));
 }
 
@@ -1767,13 +1765,13 @@
         return;
 
     GstPlayFlags flags;
-    g_object_get(m_playBin, "flags", &flags, NULL);
+    g_object_get(m_playBin.get(), "flags", &flags, NULL);
     if (m_preload == MediaPlayer::Auto) {
         LOG_MEDIA_MESSAGE("Enabling on-disk buffering");
-        g_object_set(m_playBin, "flags", flags | GST_PLAY_FLAG_DOWNLOAD, NULL);
+        g_object_set(m_playBin.get(), "flags", flags | GST_PLAY_FLAG_DOWNLOAD, NULL);
     } else {
         LOG_MEDIA_MESSAGE("Disabling on-disk buffering");
-        g_object_set(m_playBin, "flags", flags & ~GST_PLAY_FLAG_DOWNLOAD, NULL);
+        g_object_set(m_playBin.get(), "flags", flags & ~GST_PLAY_FLAG_DOWNLOAD, NULL);
     }
 }
 
@@ -1794,24 +1792,28 @@
 void MediaPlayerPrivateGStreamer::createGSTPlayBin()
 {
     ASSERT(!m_playBin);
+
+#ifdef GST_API_VERSION_1
+    // In gstreamer 1.0, gst_element_factory_make returns a floating
+    // reference so we should not adopt.
     m_playBin = gst_element_factory_make(gPlaybinName, "play");
-
-#ifndef GST_API_VERSION_1
-    m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin);
+#else
+    m_playBin = adoptGRef(gst_element_factory_make(gPlaybinName, "play"));
+    m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin.get());
 #endif
 
-    GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_playBin));
+    GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_playBin.get()));
     gst_bus_add_signal_watch(bus);
     g_signal_connect(bus, "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
     gst_object_unref(bus);
 
-    g_object_set(m_playBin, "mute", m_player->muted(), NULL);
+    g_object_set(m_playBin.get(), "mute", m_player->muted(), NULL);
 
-    g_signal_connect(m_playBin, "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
-    g_signal_connect(m_playBin, "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this);
-    g_signal_connect(m_playBin, "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this);
-    g_signal_connect(m_playBin, "video-changed", G_CALLBACK(mediaPlayerPrivateVideoChangedCallback), this);
-    g_signal_connect(m_playBin, "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this);
+    g_signal_connect(m_playBin.get(), "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
+    g_signal_connect(m_playBin.get(), "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this);
+    g_signal_connect(m_playBin.get(), "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this);
+    g_signal_connect(m_playBin.get(), "video-changed", G_CALLBACK(mediaPlayerPrivateVideoChangedCallback), this);
+    g_signal_connect(m_playBin.get(), "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this);
 
 #ifndef GST_API_VERSION_1
     m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get());
@@ -1892,9 +1894,9 @@
     gst_element_add_pad(m_videoSinkBin, gst_ghost_pad_new("sink", pad.get()));
 
     // Set the bin as video sink of playbin.
-    g_object_set(m_playBin, "video-sink", m_videoSinkBin, NULL);
+    g_object_set(m_playBin.get(), "video-sink", m_videoSinkBin, NULL);
 #else
-    g_object_set(m_playBin, "video-sink", actualVideoSink, NULL);
+    g_object_set(m_playBin.get(), "video-sink", actualVideoSink, NULL);
 #endif
 
     GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink, "sink"));

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (140413 => 140414)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2013-01-22 12:46:03 UTC (rev 140413)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2013-01-22 12:55:22 UTC (rev 140414)
@@ -158,7 +158,7 @@
 
         private:
             MediaPlayer* m_player;
-            GstElement* m_playBin;
+            GRefPtr<GstElement> m_playBin;
             GstElement* m_webkitVideoSink;
             GstElement* m_videoSinkBin;
             GstElement* m_fpsSink;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to