Title: [138576] trunk/Source/WebCore
Revision
138576
Author
[email protected]
Date
2012-12-30 06:57:20 -0800 (Sun, 30 Dec 2012)

Log Message

Regression(r138545): Makes WebAudio tests crash
https://bugs.webkit.org/show_bug.cgi?id=105869

Reviewed by Philippe Normand.

Stop using smart pointers and adoptGRef() for the
GstBus object and call gst_object_unref() manually.
This fixes assertions hits when calling adoptGRef()
since the GstBus object has a floating reference.

Alternatively, we could keep using smart pointers
and stop calling adoptGRef() so that
gst_object_ref_sink() is called and the floating
flag is cleared but I think it is clearer to do
it manually here.

No new tests, already covered by existing tests.

* platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
(WebCore::messageCallback):
(WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
(WebCore::AudioDestinationGStreamer::~AudioDestinationGStreamer):
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::~AudioFileReader):
(WebCore::AudioFileReader::decodeAudioForBusCreation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138575 => 138576)


--- trunk/Source/WebCore/ChangeLog	2012-12-30 14:52:13 UTC (rev 138575)
+++ trunk/Source/WebCore/ChangeLog	2012-12-30 14:57:20 UTC (rev 138576)
@@ -1,3 +1,31 @@
+2012-12-30  Christophe Dumez  <[email protected]>
+
+        Regression(r138545): Makes WebAudio tests crash
+        https://bugs.webkit.org/show_bug.cgi?id=105869
+
+        Reviewed by Philippe Normand.
+
+        Stop using smart pointers and adoptGRef() for the
+        GstBus object and call gst_object_unref() manually.
+        This fixes assertions hits when calling adoptGRef()
+        since the GstBus object has a floating reference.
+
+        Alternatively, we could keep using smart pointers
+        and stop calling adoptGRef() so that
+        gst_object_ref_sink() is called and the floating
+        flag is cleared but I think it is clearer to do
+        it manually here.
+
+        No new tests, already covered by existing tests.
+
+        * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
+        (WebCore::messageCallback):
+        (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
+        (WebCore::AudioDestinationGStreamer::~AudioDestinationGStreamer):
+        * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
+        (WebCore::AudioFileReader::~AudioFileReader):
+        (WebCore::AudioFileReader::decodeAudioForBusCreation):
+
 2012-12-29  Dimitri Glazkov  <[email protected]>
 
         Rename StyleResolver's member variable that holds SelectorChecker to a proper name.

Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp (138575 => 138576)


--- trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp	2012-12-30 14:52:13 UTC (rev 138575)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp	2012-12-30 14:57:20 UTC (rev 138576)
@@ -36,7 +36,7 @@
 // needs to handle this number of frames per cycle as well.
 const unsigned framesToPull = 128;
 
-gboolean messageCallback(GstBus* bus, GstMessage* message, AudioDestinationGStreamer* destination)
+gboolean messageCallback(GstBus*, GstMessage* message, AudioDestinationGStreamer* destination)
 {
     return destination->handleMessage(message);
 }
@@ -63,9 +63,11 @@
     , m_isPlaying(false)
 {
     m_pipeline = gst_pipeline_new("play");
-    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline)));
-    gst_bus_add_signal_watch(bus.get());
-    g_signal_connect(bus.get(), "message", G_CALLBACK(messageCallback), this);
+    GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
+    ASSERT(bus);
+    gst_bus_add_signal_watch(bus);
+    g_signal_connect(bus, "message", G_CALLBACK(messageCallback), this);
+    gst_object_unref(bus);
 
     GstElement* webkitAudioSrc = reinterpret_cast<GstElement*>(g_object_new(WEBKIT_TYPE_WEB_AUDIO_SRC,
                                                                             "rate", sampleRate,
@@ -87,8 +89,10 @@
 
 AudioDestinationGStreamer::~AudioDestinationGStreamer()
 {
-    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline)));
-    g_signal_handlers_disconnect_by_func(bus.get(), reinterpret_cast<gpointer>(messageCallback), this);
+    GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
+    ASSERT(bus);
+    g_signal_handlers_disconnect_by_func(bus, reinterpret_cast<gpointer>(messageCallback), this);
+    gst_object_unref(bus);
     gst_element_set_state(m_pipeline, GST_STATE_NULL);
     gst_object_unref(m_pipeline);
 }

Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp (138575 => 138576)


--- trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp	2012-12-30 14:52:13 UTC (rev 138575)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp	2012-12-30 14:57:20 UTC (rev 138576)
@@ -148,8 +148,10 @@
 AudioFileReader::~AudioFileReader()
 {
     if (m_pipeline) {
-        GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline)));
-        g_signal_handlers_disconnect_by_func(bus.get(), reinterpret_cast<gpointer>(messageCallback), this);
+        GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
+        ASSERT(bus);
+        g_signal_handlers_disconnect_by_func(bus, reinterpret_cast<gpointer>(messageCallback), this);
+        gst_object_unref(bus);
         gst_element_set_state(m_pipeline, GST_STATE_NULL);
         gst_object_unref(GST_OBJECT(m_pipeline));
     }
@@ -331,9 +333,11 @@
     // A deinterleave element is added once a src pad becomes available in decodebin.
     m_pipeline = gst_pipeline_new(0);
 
-    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline)));
-    gst_bus_add_signal_watch(bus.get());
-    g_signal_connect(bus.get(), "message", G_CALLBACK(messageCallback), this);
+    GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
+    ASSERT(bus);
+    gst_bus_add_signal_watch(bus);
+    g_signal_connect(bus, "message", G_CALLBACK(messageCallback), this);
+    gst_object_unref(bus);
 
     GstElement* source;
     if (m_data) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to