How to detect when all packets in pipeline are fully processed

bojan74 bojan.flander at gmail.com
Sun Sep 6 09:53:25 UTC 2020


Nicolas thank you for answer!

Maybe is better to explain what I am doing now so you can easily correct me
on "real example":

1. on appsrc I am pushing buffers like this in for loop without pauses - I
am setting buffer times (PTS, duration timestamp):
g_signal_emit_by_name(appsrcvideo0, "push-buffer", buffer, &ret);

2. when all buffers are pushed I call this inside closing procedure to
handle messages on bus:
bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
bus_watch_id = gst_bus_add_watch(bus, *bus_call*, mainloop);
...

In handler *bus_call* I am checking for EOS:
switch (GST_MESSAGE_TYPE(msg)) {
		case GST_MESSAGE_EOS:
			g_main_loop_quit(mainloop);
			break;

3. I send EOS to pipeline in separate thread during closing procedure:
gst_element_send_event(pipeline, gst_event_new_eos());

4. In the main thread I am waiting in main_loop till above EOS event will
not quit main loop and pause/null pipeline:
	g_main_loop_run(mainloop);

	gst_element_set_state(pipeline, GST_STATE_PAUSED);
	gst_element_set_state(pipeline, GST_STATE_NULL);

If I execute EOS immediately after all packets are pushed into pipeline
without pauses then bus detects EOS message while packets are still coming
to filesink and I get only a few seconds of video file.


So as I wrote above I am waiting for EOS on bus but I get EOS message before
all packets are processed.

What I am doing wrong or what do I have to change that EOS will not be
handled before all packets arrive to filesink?




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list