[rhythmbox] xfade: only try to set stream uri tags on decoders that handle it properly



commit d1d2f0e0a1d0c1d8eae3d25c4e57b3f07ff65179
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Nov 1 22:35:10 2015 +1000

    xfade: only try to set stream uri tags on decoders that handle it properly
    
    The GstAudioDecoder base class doesn't send events downstream immediately,
    which means we don't deadlock when we send events to it from a callback
    that gets called because it sent an event downstream.  We can't be sure
    that this is true for decoders that don't use this base class, so we play
    it safe by now setting the stream uri tag on them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756992

 backends/gstreamer/rb-player-gst-xfade.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index f51f9d8..739e4c8 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -146,6 +146,7 @@
 #include <gst/controller/gstdirectcontrolbinding.h>
 #include <gst/base/gstbasetransform.h>
 #include <gst/audio/streamvolume.h>
+#include <gst/audio/gstaudiodecoder.h>
 #include <gst/pbutils/pbutils.h>
 
 #include "rb-player.h"
@@ -2057,11 +2058,23 @@ add_stream_uri_tag (GstPad *pad, RBXFadeStream *stream)
        target = gst_ghost_pad_get_target (GST_GHOST_PAD (t2));
        probe_id = gst_pad_add_probe (target, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, drop_events, NULL, NULL);
 
-       /* get the decoder sink pad and push the tags through it */
+       /*
+        * if the decoder is not a GstAudioDecoder, it may send the tag event
+        * directly through its sink pad, which would cause deadlock.  since
+        * there are few examples of decoders that do not use the
+        * GstAudioDecoder base class, and the most notable one (modplug)
+        * doesn't provide interesting tag events, not having stream uri tags
+        * won't be a problem.
+        */
+
        e = GST_ELEMENT (gst_pad_get_parent (target));
-       sink = gst_element_get_static_pad (e, "sink");
-       gst_pad_send_event (sink, gst_event_new_tag (t));
-       gst_object_unref (sink);
+       if (GST_IS_AUDIO_DECODER (e)) {
+               sink = gst_element_get_static_pad (e, "sink");
+               gst_pad_send_event (sink, gst_event_new_tag (t));
+               gst_object_unref (sink);
+       } else {
+               rb_debug ("not setting stream uri tag for %s", GST_OBJECT_NAME (e));
+       }
        gst_object_unref (e);
 
        gst_pad_remove_probe (target, probe_id);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]