blocking execution until multifilesink gets an EOS event

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

blocking execution until multifilesink gets an EOS event

themanonthemoon
This post was updated on .
I send an EOS event through a particular branch of my pipeline, and I'm
pretty confident the EOS event is being received by the sink, but I want to
be able to block execution until it is received.

My pipeline looks like this
                                                     other_queue ---> <stuff> ---> fakesink          
                                                   /
source stuff ---> encoder ---> tee
                                                   \
                                                     saving_queue ---> <stuff> ---> splitmuxsink

my code looks like this:



/* send EOS logic */
GstPad* saving_queue_src_pad = gst_element_get_static_pad(saving_queue,
"src");

gst_pad_add_probe(saving_queue_src_pad, GST_PAD_PROBE_TYPE_BLOCK |
GST_PAD_PROBE_TYPE_BUFFER, block_saving_callback, this, NULL);

g_object_set(pipeline, "message-forward", true, NULL);

GstPad* peer_pad = gst_pad_get_peer(saving_queue_src_pad),;
gst_pad_send_event(peer_pad, gst_event_new_eos());


/* wait for EOS */
GstClockTime timeout = 10 * GST_SECOND;
GstMessage* msg;

msg = gst_bus_timed_pop_filtered(
    gst_element_get_bus(pipeline), timeout,
    static_cast<GstMessageType>(GST_MESSAGE_EOS | GST_MESSAGE_ERROR));

if (msg == NULL) {
  std::cout << "EOS timeout" << std::endl;
} else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
  std::cout << "EOS error" << std::endl;
} else {
  std::cout << "EOS received by splitmuxsink" << std::endl;
}

if (msg) gst_message_unref(msg);
gst_object_unref(saving_queue_src_pad);
gst_object_unref(peer_pad);




I am finding that this always times out. My questions:

1. Is there something clearly wrong with this code?
2. Is it possible to only check the splitmuxsink element to see if it got an
EOS?

One more thing, due to the way my code is structured, it is important for
this to be checked synchronously (as a blocking call) rather than
asynchronously.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: blocking execution until multifilesink gets an EOS event

Michael Gruner
If I recall correctly, the EOS gets posted to the bus until all sinks in the pipeline receive an EOS. In this case, only one sink is receiving the EOS.

You can either send the EOS to the entire pipe (using gst_element_send_event (pipeline, gst_event_new_eos())) or wait instead for an Element message, which wraps the EOS.

Michael
www.ridgerun.com


> On Jun 5, 2019, at 12:31 PM, themanonthemoon <[hidden email]> wrote:
>
> I send an EOS event through a particular branch of my pipeline, and I'm
> pretty confident the EOS event is being received by the sink, but I want to
> be able to block execution until it is received.
>
> My pipeline looks like this
>                                                     other_queue --->
> <stuff> ---> fakesink          
>                                                   /
> source stuff ---> encoder ---> tee
>                                                   \
>                                                     saving_queue --->
> <stuff> ---> splitmuxsink
>
> my code looks like this:
>
>
>
> /* send EOS logic */
> GstPad* saving_queue_src_pad = gst_element_get_static_pad(saving_queue,
> "src");
>
> gst_pad_add_probe(saving_queue_src_pad, GST_PAD_PROBE_TYPE_BLOCK |
> GST_PAD_PROBE_TYPE_BUFFER, block_saving_callback, this, NULL);
>
> g_object_set(pipeline, "message-forward", true, NULL);
>
> GstPad* peer_pad = gst_pad_get_peer(saving_queue_src_pad),;
> gst_pad_send_event(peer_pad, gst_event_new_eos());
>
>
> /* wait for EOS */
> GstClockTime timeout = 10 * GST_SECOND;
> GstMessage* msg;
>
> msg = gst_bus_timed_pop_filtered(
>    gst_element_get_bus(pipeline), timeout,
>    static_cast<GstMessageType>(GST_MESSAGE_EOS | GST_MESSAGE_ERROR));
>
> if (msg == NULL) {
>  std::cout << "EOS timeout" << std::endl;
> } else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
>  std::cout << "EOS error" << std::endl;
> } else {
>  std::cout << "EOS received by splitmuxsink" << std::endl;
> }
>
> if (msg) gst_message_unref(msg);
> gst_message_unref(saving_queue_src_pad);
> gst_message_unref(peer_pad);
>
>
>
>
> I am finding that this always times out. My questions:
>
> 1. Is there something clearly wrong with this code?
> 2. Is it possible to only check the splitmuxsink element to see if it got an
> EOS?
>
> One more thing, due to the way my code is structured, it is important for
> this to be checked synchronously (as a blocking call) rather than
> asynchronously.
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: blocking execution until multifilesink gets an EOS event

themanonthemoon
Ok so I arrived at a solution. Michael you are right about what you said but
I turned on the 'message-forward' property of the pipeline which means that
each individual sink will emit an EOS as they receive them.

What I DIDN'T know, is that the EOS would be wrapped in an element message
as you said. Sure enough I received an element message with the EOS.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel