audio: Prevent double seeks in appsrc (fixes: #1404)
Sending the seek event to the playbin forwards it to all sinks. Which in turn means on seek event per sink. To avoid this we inject the seek event in an element before the tee.
This commit is contained in:
parent
30b50b64d3
commit
0336b6077c
@ -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
|
||||
-------
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user