From a036e84a20c7430d42ba4d05110ce546bcf0ced1 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Thu, 5 Dec 2013 22:43:27 +0100 Subject: [PATCH] audio: Update scanner to not use gst.Bus.poll Turns out poll sets up it's own mainloop in the default context causing us to segfault. --- mopidy/audio/scan.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 12476c2c..6999d664 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -83,15 +83,14 @@ class Scanner(object): """Polls for messages to collect data.""" start = time.time() timeout_s = self._timeout_ms / float(1000) - poll_timeout_ns = 1000 data = {} while time.time() - start < timeout_s: - message = self._bus.poll(gst.MESSAGE_ANY, poll_timeout_ns) + if not self._bus.have_pending(): + continue + message = self._bus.pop() - if message is None: - pass # polling the bus timed out. - elif message.type == gst.MESSAGE_ERROR: + if message.type == gst.MESSAGE_ERROR: raise exceptions.ScannerError(message.parse_error()[0]) elif message.type == gst.MESSAGE_EOS: return data