From 20b1c21b0b5847f2c0bb33eb050e3fc3020b83a6 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 26 Oct 2015 23:52:17 +0100 Subject: [PATCH] gst1: Avoid using pipeline.get_clock() Often the clock isn't available for use. gst_pipeline_clock() which is always available requires Gst 1.6. --- mopidy/audio/scan.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index c51762b9..718f2d6e 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -2,6 +2,7 @@ from __future__ import ( absolute_import, division, print_function, unicode_literals) import collections +import time import gi gi.require_version('Gst', '1.0') @@ -129,9 +130,7 @@ def _query_seekable(pipeline): def _process(pipeline, timeout_ms): - clock = pipeline.get_clock() bus = pipeline.get_bus() - timeout = timeout_ms * Gst.MSECOND tags = {} mime = None have_audio = False @@ -146,9 +145,10 @@ def _process(pipeline, timeout_ms): Gst.MessageType.TAG ) - previous = clock.get_time() + timeout = timeout_ms + previous = int(time.time() * 1000) while timeout > 0: - message = bus.timed_pop_filtered(timeout, types) + message = bus.timed_pop_filtered(timeout * Gst.MSECOND, types) if message is None: break @@ -180,7 +180,7 @@ def _process(pipeline, timeout_ms): # Note that this will only keep the last tag. tags.update(utils.convert_taglist(taglist)) - now = clock.get_time() + now = int(time.time() * 1000) timeout -= now - previous previous = now