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.
This commit is contained in:
Thomas Adamcik 2013-12-05 22:43:27 +01:00
parent 4142f0285b
commit a036e84a20

View File

@ -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