Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable buffering handling during track change. (Fixes #1722) #1740

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/changelog.rst
Expand Up @@ -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)
===================

Expand Down
10 changes: 8 additions & 2 deletions mopidy/audio/actor.py
Expand Up @@ -256,7 +256,7 @@ def on_playbin_state_changed(self, old_state, new_state, pending_state):
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
Expand All @@ -274,6 +274,10 @@ def on_playbin_state_changed(self, old_state, new_state, pending_state):
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)
Expand Down Expand Up @@ -705,7 +709,6 @@ def stop_playback(self):

:rtype: :class:`True` if successfull, else :class:`False`
"""
self._buffering = False
return self._set_state(Gst.State.NULL)

def wait_for_state_change(self):
Expand Down Expand Up @@ -748,6 +751,9 @@ def _set_state(self, state):
: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(
Expand Down