From 2f33a6c4ffd780ac9c2fe4d881f516e265032d9a Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 10 Sep 2012 23:19:40 +0200 Subject: [PATCH] Only remove signal watch if it has been added If removing unconditionally, we get the following error message: GStreamer-CRITICAL **: Bus bus2 has no signal watches attached --- mopidy/gstreamer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mopidy/gstreamer.py b/mopidy/gstreamer.py index a1ddc93e..b8b30d14 100644 --- a/mopidy/gstreamer.py +++ b/mopidy/gstreamer.py @@ -32,6 +32,7 @@ class GStreamer(ThreadingActor): def __init__(self): super(GStreamer, self).__init__() + self._default_caps = gst.Caps(""" audio/x-raw-int, endianness=(int)1234, @@ -40,12 +41,15 @@ class GStreamer(ThreadingActor): depth=(int)16, signed=(boolean)true, rate=(int)44100""") + self._pipeline = None self._source = None self._uridecodebin = None self._output = None self._mixer = None + self._message_processor_set_up = False + def on_start(self): try: self._setup_pipeline() @@ -133,10 +137,12 @@ class GStreamer(ThreadingActor): bus = self._pipeline.get_bus() bus.add_signal_watch() bus.connect('message', self._on_message) + self._message_processor_set_up = True def _teardown_message_processor(self): - bus = self._pipeline.get_bus() - bus.remove_signal_watch() + if self._message_processor_set_up: + bus = self._pipeline.get_bus() + bus.remove_signal_watch() def _on_new_source(self, element, pad): self._source = element.get_property('source')