From dfbab4bf888fc46dfddb5fe32559e86b92d316c6 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Wed, 30 Jan 2019 00:52:24 +0000 Subject: [PATCH 1/2] audio: Disable buffering handling during track change. (Fixes #1722). Skip handling buffering messages if pipeline not PLAYING or PAUSED. --- docs/changelog.rst | 3 +++ mopidy/audio/actor.py | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index fb82a844..07cad308 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -13,6 +13,9 @@ Bug fix release. - Audio: Fix switching between tracks with different sample rates. (Fixes: :issue:`1528`, PR: :issue:`1735`) +- Audio: Prevent buffering handling interfering with track changes. (Fixes: + :issue:`1722`, PR: :issue:`1740`) + v2.2.2 (2018-12-29) =================== diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 2ef36310..fb46d7ef 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -274,6 +274,10 @@ class _Handler(object): self._audio._playbin, Gst.DebugGraphDetails.ALL, 'mopidy') def on_buffering(self, percent, structure=None): + if self._audio._target_state < Gst.State.PAUSED: + gst_logger.debug('Skip buffering during track change.') + return + if structure is not None and structure.has_field('buffering-mode'): buffering_mode = structure.get_enum( 'buffering-mode', Gst.BufferingMode) @@ -705,7 +709,6 @@ class Audio(pykka.ThreadingActor): :rtype: :class:`True` if successfull, else :class:`False` """ - self._buffering = False return self._set_state(Gst.State.NULL) def wait_for_state_change(self): @@ -748,6 +751,9 @@ class Audio(pykka.ThreadingActor): :type state: :class:`Gst.State` :rtype: :class:`True` if successfull, else :class:`False` """ + if state < Gst.State.PAUSED: + self._buffering = False + self._target_state = state result = self._playbin.set_state(state) gst_logger.debug( From d6da4b5cdb14bdfb998a51623b734a92934a6e91 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Thu, 31 Jan 2019 17:35:33 +0000 Subject: [PATCH 2/2] audio: Upgrade GST state mapping race logging from DEBUG to WARN. --- mopidy/audio/actor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index fb46d7ef..a837f790 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -256,7 +256,7 @@ class _Handler(object): target_state = _GST_STATE_MAPPING.get(self._audio._target_state) if target_state is None: # XXX: Workaround for #1430, to be fixed properly by #1222. - logger.debug('Race condition happened. See #1222 and #1430.') + logger.warn('Race condition happened. See #1222 and #1430.') return if target_state == new_state: target_state = None