Use blocking calls when changing tracks on EOT.
This ensures that we block about-to-finish and the pipeline until the next URI is set, alowing for at least EOS free playback. If the uri is set quickly enough this will also be gapless.
This commit is contained in:
parent
b78d5eddac
commit
39580e1948
@ -95,6 +95,11 @@ class Audio(pykka.ThreadingActor):
|
||||
from mopidy.core import Core
|
||||
logger.debug(u'Triggering reached end of track event')
|
||||
core = pykka.ActorRegistry.get_by_class(Core)[0].proxy()
|
||||
|
||||
# Note that we can not let this function return until we have the next
|
||||
# URI set for gapless / EOS free playback. This means all the
|
||||
# subsequent remote calls to backends etc. down this code path need to
|
||||
# block.
|
||||
core.playback.on_end_of_track().get()
|
||||
|
||||
def _on_new_source(self, element, pad):
|
||||
|
||||
@ -330,10 +330,13 @@ class PlaybackController(object):
|
||||
|
||||
original_tl_track = self.current_tl_track
|
||||
|
||||
# As noted in mopidy.audio which calls this code, we need to make sure
|
||||
# the calls to the backend are blocking or gapless / EOS free playback
|
||||
# will break.
|
||||
if self.tl_track_at_eot:
|
||||
self.current_tl_track = self.tl_track_at_eot
|
||||
self._trigger_track_playback_ended()
|
||||
self._get_backend().playback.change_track(self.current_track)
|
||||
self._get_backend().playback.change_track(self.current_track).get()
|
||||
self._trigger_track_playback_started()
|
||||
|
||||
if self.consume:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user