Audio Level throws Queue.Empty

Sneha sneha.nie at gmail.com
Fri Sep 26 04:24:45 PDT 2014


I dont understand why the below code is not signalling "message" and hence
on_message method is never called. So Queue is always Empty.

What am i doing wrong?

def audio_levels():
    last_msg = Queue.Queue(maxsize=1)

    def on_message(_, msg):
        print "l1"
        if msg.type == gst.MESSAGE_ELEMENT:
            print "l2"
            if msg.structure.get_name() == "level":
                print "l3"
                last_msg.put(msg)
        return True

    pipeline_description = "audiotestsrc wave=2 freq=200 ! audioconvert !
level message=True ! fakesink sync=false"

    pipeline = gst.parse_launch(pipeline_description)
    pipeline.get_bus().add_watch(on_message)
    pipeline.set_state(gst.STATE_PLAYING)
    try:
        while True:
            msg = last_msg.get(timeout=2)
            levels = tuple(msg.structure[method])
            yield levels
    finally:
        pipeline.set_state(gst.STATE_NULL)


audio_levels()



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Audio-Level-throws-Queue-Empty-tp4668860.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list