From 9144c28483a434d298f232dccbdda0160444bd86 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 24 Oct 2012 22:35:36 +0200 Subject: [PATCH] Fix 'not-negotiated' errors on some Spotify tracks (fixes #213) --- docs/changes.rst | 6 ++++++ mopidy/audio/actor.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/changes.rst b/docs/changes.rst index 17d50072..854c90d3 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -12,6 +12,12 @@ v0.9.0 (in development) - Pykka >= 0.16 is now required. +**Bug fixes** + +- :issue:`213`: Fix "streaming task paused, reason not-negotiated" errors + observed by some users on some Spotify tracks due to a change introduced in + 0.8.0. See the issue for a patch that applies to 0.8.0. + v0.8.0 (2012-09-20) =================== diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 77b451d7..fee5f094 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -61,6 +61,21 @@ class Audio(ThreadingActor): fakesink = gst.element_factory_make('fakesink') self._playbin.set_property('video-sink', fakesink) + self._playbin.connect('notify::source', self._on_new_source) + + def _on_new_source(self, element, pad): + uri = element.get_property('uri') + if not uri or not uri.startswith('appsrc://'): + return + + # These caps matches the audio data provided by libspotify + default_caps = gst.Caps( + 'audio/x-raw-int, endianness=(int)1234, channels=(int)2, ' + 'width=(int)16, depth=(int)16, signed=(boolean)true, ' + 'rate=(int)44100') + source = element.get_property('source') + source.set_property('caps', default_caps) + def _teardown_playbin(self): self._playbin.set_state(gst.STATE_NULL)