How to detect when all packets in pipeline are fully processed

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

How to detect when all packets in pipeline are fully processed

bojan74
In a bit simplified version I have pipeline like this:
appsrc->rtpvp8depay->webmmux->filesink

I have already stored files with RTP packets.
With this pipeline I like to process those RTP packets and create webm file.

Before I have in the pipeline also rtpjitterbuffer. In that case I simulate
delays as in real time RTP packet sending. Since I simulate real timings I
know that after last RTP packet I can send EOS with a bit delay and it was
working ok. I got webm file as I wanted.

But now I want to speed this processing, so I remove jitterbuffer and now I
am pushing RTP buffers in for loop without delays.

My current problem is how do I know when all packets are processed because
this for loop sends packets very fast but it takes quite a bit time when all
are processed.
I am asking this because I saw that if I send to pipeline event EOS too soon
then I got only a part of video file because EOS come too soon when packets
are still processing.

So my question is how to know when all packets come to destination
(filesink) so I will send EOS at that moment and not before?

Thanks





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

Re: How to detect when all packets in pipeline are fully processed

bojan74
Any idea/advice? :)

I know in advance that I need to process for example 10000 RTP packets with
VP8 and for result I want webm file.

I am pushing those 10000 packets inside appsrc one after another and I just
like to know when all those packets were processed in filesink. Just to know
when I can send EOS.

Cause I found out that if I send EOS too soon then I get only a part of
whole video on filesink cause it looks like EOS came in the middle of packet
processing.

Or is there some other way to send EOS, for example as the last "special"
push inside apparc so that EOS will be processed after last packet come to
filesink?






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

Re: How to detect when all packets in pipeline are fully processed

Nicolas Dufresne-5


Le sam. 5 sept. 2020 07 h 00, bojan74 <[hidden email]> a écrit :
Any idea/advice? :)

I know in advance that I need to process for example 10000 RTP packets with
VP8 and for result I want webm file.

I am pushing those 10000 packets inside appsrc one after another and I just
like to know when all those packets were processed in filesink. Just to know
when I can send EOS.

EOS is a serialized event, that you push after the last buffer, not need to wait to send it. What you later have to wait for is the EOS message, though GstBus, directly or via the main loop.


Cause I found out that if I send EOS too soon then I get only a part of
whole video on filesink cause it looks like EOS came in the middle of packet
processing.

Or is there some other way to send EOS, for example as the last "special"
push inside apparc so that EOS will be processed after last packet come to
filesink?






--
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: How to detect when all packets in pipeline are fully processed

bojan74
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/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel