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..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 @@ -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(