Are Bus Messages Queued?
Nastooh Avessta
nastooh.avesta at gmail.com
Fri Nov 4 17:07:27 UTC 2016
Hi Tim
Thank you for your reply. Here is my use case:
1- Application solicits plugins for messages, in a serialized ordered manner
2- Plugins reply in an asynchronous manner
3- Upon receiving messages from all targeted plugins, an action is taken
Part 3, is coded inside the bus message handler:
…
case GST_MESSAGE_ELEMENT:
g_print("Got message from %s\n",gst_object_get_name (GST_MESSAGE_SRC(msg)));
int i;
for(i=0;i<messageCnt;i++){
if(!strcmp(messagePlug[i],gst_object_get_name (GST_MESSAGE_SRC(msg)))){
noMessage++;
if(noMessages==messageCnt){
g_print("Life is good\n");
}
}
}
break;
…
(Here, messageCnt is the expected number of messages to be received, and messagePlug is a pointer array containing the names of the plugins.)
What I was wondering is that while processing the current message, i.e., somewhere in that for loop, could I miss an incoming message? And if I understand you correctly, that should not be the case, as I am not popping any messages or going to NULL state. Am I correct in my understanding?
I should mention that this gstreamer 1.4.5.
Cheers,
-----Original Message-----
From: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of Tim Müller
Sent: Friday, November 04, 2016 1:47 AM
To: gstreamer-devel at lists.freedesktop.org
Subject: Re: Are Bus Messages Queued?
On Thu, 2016-11-03 at 17:42 -0700, Nastooh Avessta wrote:
Hi Nastooh,
> Got an application that would take an action, upon receiving messages
> from multiple plugins , through a watch on the app bus: (Note that
> these messages are asynchronous and may arrive at the ~ same time.) …
>
> What I am seeing is that on different runs not all messages make it to
> “case GST_MESSAGE_ELEMENT”, and am wondering if I need to queue
> messages myself, start a new processing thread per message, etc.?
No, GstBus is a message queue itself. All messages should make it through to your handler. No messages should be lost unless you pop them off the bus yourself.
Two exceptions:
If you set a pipeline to NULL state the bus is 'flushed' in the NULL-
>READY state change transition. You can disable that behaviour though.
If you pop messages off the bus e.g. with gst_bus_*_pop_filtered() in another thread whist at the same time having a bus watch set up that might interact in weird ways.
Check the GST_DEBUG=GST_BUS:6 log to see whether those messages make it to the bus in the first place.
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com _______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list