'gst_bus_add_watch' not getting bus messages

Federico Zamperini fzamperini at tiscali.it
Tue Dec 4 03:18:46 PST 2012


Hi,
	you can setup a thread that pops messages from the bus (see 
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-pop) 
and logs them.
For example the main loop of your auxiliary thread might be (be aware 
that this is just an example):

GstBus *bus = gst_element_get_bus(your pipeline here);
GstMessage *msg = NULL;

while(TRUE) {

	// get all the messages that are currently queued in the bus
	do {
		msg = gst_bus_pop(bus);
		if(msg == NULL)
			break; // no mesages at the moment, will try again later

		// log msg infos here ...

		gst_message_unref(msg);
	} while(msg != NULL);

	// take a nap (300ms)
	usleep(300 * 1000);

	// loop again to see if new messages are in the bus
}

Il 04/12/2012 10:12, deepthips ha scritto:
> Hi
>
> I am using 'gst_bus_add_watch' for monitoring bus messages. For a long time,
> I had  an issue that the bus call function was not getting called. Tried
> gst_bus_set_sync_handler as well. Then found the root issue to be a sleep in
> the main function. Found that the sleep was causing a delay by which buscall
> function was not getting invoked. Now, I have integrated this to a large
> application and again I am not getting bus messages. Something like sleep or
> some other loop may be causing this issue. But no idea on how to debug this.
> Is there any mechanism by which I can get past this.? Is there any way by
> which I can listen to bus messages without using 'gst_bus_add_watch' or
> gst_bus_set_sync_handler . Both are not working.



More information about the gstreamer-devel mailing list