Merge pull request #1740 from kingosticks/fix/change-track-buffering-alt

Disable buffering handling during track change. (Fixes #1722)
This commit is contained in:
Nick Steel 2019-01-31 23:15:25 +00:00 committed by GitHub
commit e5c03fbff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -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)
===================

View File

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