scanner: minor simplification of timeout calculations
This commit is contained in:
parent
57518861ea
commit
6379f76889
@ -160,7 +160,7 @@ def _process(pipeline, timeout_ms):
|
|||||||
)
|
)
|
||||||
|
|
||||||
timeout = timeout_ms
|
timeout = timeout_ms
|
||||||
previous = int(time.time() * 1000)
|
start = int(time.time() * 1000)
|
||||||
while timeout > 0:
|
while timeout > 0:
|
||||||
message = bus.timed_pop_filtered(timeout * Gst.MSECOND, types)
|
message = bus.timed_pop_filtered(timeout * Gst.MSECOND, types)
|
||||||
|
|
||||||
@ -209,9 +209,7 @@ def _process(pipeline, timeout_ms):
|
|||||||
# Note that this will only keep the last tag.
|
# Note that this will only keep the last tag.
|
||||||
tags.update(tags_lib.convert_taglist(taglist))
|
tags.update(tags_lib.convert_taglist(taglist))
|
||||||
|
|
||||||
now = int(time.time() * 1000)
|
timeout = timeout_ms - ( int(time.time() * 1000) - start )
|
||||||
timeout -= now - previous
|
|
||||||
previous = now
|
|
||||||
|
|
||||||
# workaround for https://bugzilla.gnome.org/show_bug.cgi?id=763553:
|
# workaround for https://bugzilla.gnome.org/show_bug.cgi?id=763553:
|
||||||
# if we got what we want then stop playing (and wait for ASYNC_DONE)
|
# if we got what we want then stop playing (and wait for ASYNC_DONE)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user