Title: [109933] trunk/Source/WebCore
Revision
109933
Author
[email protected]
Date
2012-03-06 10:15:00 -0800 (Tue, 06 Mar 2012)

Log Message

Unreleased gst_object_reference to audio sink in MediaPlayerPrivateGStreamer
https://bugs.webkit.org/show_bug.cgi?id=79795

Bug fix: Used a GRefPtr to hold the reference to the audio sink instead of a GstElement*.
Code cleanup: Used the same pattern for webkit web source and removed explicit gst_unref in destructor.

Patch by David Corvoysier <[email protected]> on 2012-03-06
Reviewed by Philippe Normand.

No new tests. No change in behavior.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109932 => 109933)


--- trunk/Source/WebCore/ChangeLog	2012-03-06 18:03:02 UTC (rev 109932)
+++ trunk/Source/WebCore/ChangeLog	2012-03-06 18:15:00 UTC (rev 109933)
@@ -1,3 +1,20 @@
+2012-03-06  David Corvoysier  <[email protected]>
+
+        Unreleased gst_object_reference to audio sink in MediaPlayerPrivateGStreamer
+        https://bugs.webkit.org/show_bug.cgi?id=79795
+
+        Bug fix: Used a GRefPtr to hold the reference to the audio sink instead of a GstElement*.
+        Code cleanup: Used the same pattern for webkit web source and removed explicit gst_unref in destructor.
+
+        Reviewed by Philippe Normand.
+
+        No new tests. No change in behavior.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2012-03-06  Patrick Gansterer  <[email protected]>
 
         [CMake] Build fix for !ENABLE(WORKERS) after r109556 and r109833.

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-03-06 18:03:02 UTC (rev 109932)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-03-06 18:15:00 UTC (rev 109933)
@@ -30,7 +30,6 @@
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
-#include "GRefPtrGStreamer.h"
 #include "GStreamerGWorld.h"
 #include "GStreamerVersioning.h"
 #include "GraphicsContext.h"
@@ -262,11 +261,6 @@
         m_mediaLocations = 0;
     }
 
-    if (m_source) {
-        gst_object_unref(m_source);
-        m_source = 0;
-    }
-
     if (m_videoSinkBin) {
         gst_object_unref(m_videoSinkBin);
         m_videoSinkBin = 0;
@@ -958,9 +952,9 @@
     GstFormat fmt = GST_FORMAT_BYTES;
     gint64 length = 0;
 #ifdef GST_API_VERSION_1
-    if (gst_element_query_duration(m_source, fmt, &length)) {
+    if (gst_element_query_duration(m_source.get(), fmt, &length)) {
 #else
-    if (gst_element_query_duration(m_source, &fmt, &length)) {
+    if (gst_element_query_duration(m_source.get(), &fmt, &length)) {
 #endif
         LOG_VERBOSE(Media, "totalBytes %" G_GINT64_FORMAT, length);
         return static_cast<unsigned>(length);
@@ -968,7 +962,7 @@
 
     // Fall back to querying the source pads manually.
     // See also https://bugzilla.gnome.org/show_bug.cgi?id=638749
-    GstIterator* iter = gst_element_iterate_src_pads(m_source);
+    GstIterator* iter = gst_element_iterate_src_pads(m_source.get());
     bool done = false;
     while (!done) {
 #ifdef GST_API_VERSION_1
@@ -1036,7 +1030,7 @@
     GstQuery* query = gst_query_new_position(GST_FORMAT_BYTES);
     gint64 position = 0;
 
-    if (m_webkitAudioSink && gst_element_query(m_webkitAudioSink, query))
+    if (m_webkitAudioSink && gst_element_query(m_webkitAudioSink.get(), query))
         gst_query_parse_position(query, 0, &position);
 
     gst_query_unref(query);
@@ -1060,30 +1054,23 @@
     if (!m_playBin)
         return;
 
-    GRefPtr<GstElement> element;
     GstElement* sinkPtr = 0;
 
     g_object_get(m_playBin, "audio-sink", &sinkPtr, NULL);
-    element = adoptGRef(sinkPtr);
+    m_webkitAudioSink = adoptGRef(sinkPtr);
 
-    gst_object_replace(reinterpret_cast<GstObject**>(&m_webkitAudioSink),
-                       reinterpret_cast<GstObject*>(element.get()));
 }
 
 
 void MediaPlayerPrivateGStreamer::sourceChanged()
 {
-    GRefPtr<GstElement> element;
     GstElement* srcPtr = 0;
 
     g_object_get(m_playBin, "source", &srcPtr, NULL);
-    element = adoptGRef(srcPtr);
+    m_source = adoptGRef(srcPtr);
 
-    gst_object_replace(reinterpret_cast<GstObject**>(&m_source),
-                       reinterpret_cast<GstObject*>(element.get()));
-
-    if (WEBKIT_IS_WEB_SRC(element.get()))
-        webKitWebSrcSetMediaPlayer(WEBKIT_WEB_SRC(element.get()), m_player);
+    if (WEBKIT_IS_WEB_SRC(m_source.get()))
+        webKitWebSrcSetMediaPlayer(WEBKIT_WEB_SRC(m_source.get()), m_player);
 }
 
 void MediaPlayerPrivateGStreamer::cancelLoad()

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-03-06 18:03:02 UTC (rev 109932)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-03-06 18:15:00 UTC (rev 109933)
@@ -24,12 +24,13 @@
 #define MediaPlayerPrivateGStreamer_h
 #if ENABLE(VIDEO) && USE(GSTREAMER)
 
-#include <wtf/Forward.h>
+#include "GRefPtrGStreamer.h"
 #include "MediaPlayerPrivate.h"
 #include "Timer.h"
 
 #include <glib.h>
 #include <gst/gst.h>
+#include <wtf/Forward.h>
 
 typedef struct _WebKitVideoSink WebKitVideoSink;
 typedef struct _GstBuffer GstBuffer;
@@ -154,7 +155,7 @@
             GstElement* m_webkitVideoSink;
             GstElement* m_videoSinkBin;
             GstElement* m_fpsSink;
-            GstElement* m_source;
+            GRefPtr<GstElement> m_source;
             float m_seekTime;
             bool m_changingRate;
             float m_endTime;
@@ -189,7 +190,7 @@
             bool m_hasAudio;
             guint m_audioTimerHandler;
             guint m_videoTimerHandler;
-            GstElement* m_webkitAudioSink;
+            GRefPtr<GstElement> m_webkitAudioSink;
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to