Merge pull request #1426 from adamcik/fix/1404-duplicate-seeks

audio: Prevent double seeks in appsrc (fixes: #1404)
This commit is contained in:
Stein Magnus Jodal 2016-02-03 23:40:31 +01:00
commit 79cdc16d64
2 changed files with 12 additions and 1 deletions

View File

@ -156,6 +156,10 @@ Audio
argument is no longer in use and will be removed in the future. As far as we
know, this is only used by Mopidy-Spotify.
- Duplicate seek events getting to AppSrc based backends is now fixed. This
should prevent seeking in Mopidy-Spotify from glitching.
(Fixes: :issue:`1404`)
Gapless
-------

View File

@ -385,6 +385,7 @@ class Audio(pykka.ThreadingActor):
self._playbin = None
self._outputs = None
self._queue = None
self._about_to_finish_callback = None
self._handler = _Handler(self)
@ -481,6 +482,7 @@ class Audio(pykka.ThreadingActor):
audio_sink.add_pad(ghost_pad)
self._playbin.set_property('audio-sink', audio_sink)
self._queue = queue
def _teardown_mixer(self):
if self.mixer:
@ -628,7 +630,12 @@ class Audio(pykka.ThreadingActor):
# TODO: double check seek flags in use.
gst_position = utils.millisecond_to_clocktime(position)
gst_logger.debug('Sending flushing seek: position=%r', gst_position)
result = self._playbin.seek_simple(
# Send seek event to the queue not the playbin. The default behavior
# for bins is to forward this event to all sinks. Which results in
# duplicate seek events making it to appsrc. Since elements are not
# allowed to act on the seek event, only modify it, this should be safe
# to do.
result = self._queue.seek_simple(
Gst.Format.TIME, Gst.SeekFlags.FLUSH, gst_position)
return result