how to make sure bus messages expected/received?

Sergei Vorobyov sergei.vorobyov at facilitylabs.com
Fri Jun 13 04:47:00 PDT 2014


Sorry for a simple question, I could do it by using mutexes, of course, but
maybe there is a canonical way of doing it using the GStreamer APIs?

The problem is this.

1. In one thread, periodically, in the loop, I am waiting for a message on
the bus:

msg = gst_bus_timed_pop_filtered (bus, duration,
                                          (GstMessageType)(GST_MESSAGE_EOS
|

 GST_MESSAGE_SEGMENT_DONE |

 GST_MESSAGE_ERROR |

 GST_MESSAGE_APPLICATION));

and this waiting occupies only part of the whole loop:

for(;;) {
  // do smth else...

  msg = gst_bus_timed_pop_filtered...

  // do smth else ...
}

In the other thread I am posting (using the GStreamer's gift):

gst_bus_post (bus, gst_message_new_application (NULL, NULL));

But how can I make sure, before posting, that it is being expected (and
received) by the blocking

msg = gst_bus_timed_pop_filtered... in the other thread,

and not consumed by the loop doing smth else?

Actually, the boolean TRUE returned by gst_bus_post does not guarantee that
the posting was expected and received.

One might naively think that the following is a solution (simply surround
with gst_bus_set_flushing):

for(;;) {
  // do smth else...

  gst_bus_set_flushing (bus, FALSE);
  msg = gst_bus_timed_pop_filtered...
  gst_bus_set_flushing (bus, TRUE);

  // do smth else ...
}

However, it isn't. Imagine gst_bus_timed_pop_filtered returns because
duration expired, but before the next gst_bus_set_flushing (bus, TRUE) the
other thread makes gst_bus_post (bus, gst_message_new_application (NULL,
NULL)). Then this posting is acknowledged (returns TRUE) but the message is
actually flushed.

Some real acknowledge mechanism is desired. Does it exist in the GStreamer
API?

Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140613/d6f49a81/attachment.html>


More information about the gstreamer-devel mailing list