audio: Try and simplify logic for going to playing in scanner
This commit is contained in:
parent
c972ecd1f2
commit
e9137e132a
@ -192,14 +192,18 @@ def _process(pipeline, timeout_ms):
|
|||||||
duration = duration // Gst.MSECOND
|
duration = duration // Gst.MSECOND
|
||||||
else:
|
else:
|
||||||
duration = None
|
duration = None
|
||||||
if (tags and duration is not None
|
|
||||||
# workaround for
|
if tags and duration is not None:
|
||||||
# https://bugzilla.gnome.org/show_bug.cgi?id=763553:
|
|
||||||
# try to start pipeline playing; if it doesn't then
|
|
||||||
# give up:
|
|
||||||
) or (pipeline.set_state(Gst.State.PLAYING) ==
|
|
||||||
Gst.StateChangeReturn.FAILURE):
|
|
||||||
return tags, mime, have_audio, duration
|
return tags, mime, have_audio, duration
|
||||||
|
|
||||||
|
# Workaround for upstream bug which causes tags/duration to arrive
|
||||||
|
# after pre-roll. We get around this by starting to play the track
|
||||||
|
# and then waiting for a duration change.
|
||||||
|
# https://bugzilla.gnome.org/show_bug.cgi?id=763553
|
||||||
|
result = pipeline.set_state(Gst.State.PLAYING)
|
||||||
|
if result == Gst.StateChangeReturn.FAILURE:
|
||||||
|
return tags, mime, have_audio, duration
|
||||||
|
|
||||||
elif message.type == Gst.MessageType.DURATION_CHANGED:
|
elif message.type == Gst.MessageType.DURATION_CHANGED:
|
||||||
# duration will be read after ASYNC_DONE received; for now
|
# duration will be read after ASYNC_DONE received; for now
|
||||||
# just give it a non-None value to flag that we have a duration:
|
# just give it a non-None value to flag that we have a duration:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user