Flushing the pipeline in GST 0.10

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

Flushing the pipeline in GST 0.10

nightfury
Hi All,
I am trying to send the flush event from the bin. But the piece of code keeps failing :

GstEvent* flush_start = gst_event_new_flush_start();
ret = gst_element_send_event(GST_ELEMENT(pipeline), flush_start);

But the return value is always 0. Why is this so?

Is there something wrong I am doing? Are there any prerequisites that need to be handles before sendng the flush event?

Thanks,
Vikas
Reply | Threaded
Open this post in threaded view
|

Re: Flushing the pipeline in GST 0.10

Nicolas Dufresne-3
Le mardi 27 mai 2014 à 05:34 -0700, vks7979 a écrit :
Hi All,
I am trying to send the flush event from the bin. But the piece of code
keeps failing :

GstEvent* flush_start = gst_event_new_flush_start();
ret = gst_element_send_event(GST_ELEMENT(pipeline), flush_start);

Quick answer, you can't send a flush event from application side. Basesrc will make sure of that by dropping it (and warn). Google first MSE prototype was doing that, so that might explain why it exist when you google it.

But the return value is always 0. Why is this so?
The why is that only the element driving the element can do that correctly (and without race).

Is there something wrong I am doing? Are there any prerequisites that need
to be handles before sendng the flush event?

To flush a pipeline from application side you have two options though. First is to operate a flushing seek, you can pass NONE position iirc. The other option is to go into READY state (or NULL).

Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Flushing the pipeline in GST 0.10

nightfury
Thank you Nicolas. I will try these two methods out.

I also found the bug that was filed for this flush issue. Posting it here.
https://bugzilla.gnome.org/show_bug.cgi?id=689113
Reply | Threaded
Open this post in threaded view
|

Re: Flushing the pipeline in GST 0.10

Tim Müller
In reply to this post by Nicolas Dufresne-3
On Tue, 2014-05-27 at 09:37 -0400, Nicolas Dufresne wrote:

> Quick answer, you can't send a flush event from application side.
> Basesrc will make sure of that by dropping it (and warn). Google first
> MSE prototype was doing that, so that might explain why it exist when
> you google it.
>  (...)
> To flush a pipeline from application side you have two options though.
> First is to operate a flushing seek, you can pass NONE position iirc.
> The other option is to go into READY state (or NULL).

Sending flush start/stop should work as well really, depending on the
exact pipeline, and one might need to make sure the source thread is
running again. It didn't work in 0.10 IIRC, but has since been fixed up
here and there in 1.x.

 Cheers
  -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

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

Re: Flushing the pipeline in GST 0.10

nightfury
This post was updated on .
Tim :
Yup we can flush it. I am sending the flush event directly to the sink pad using gst_pad_send_event().
But when we resume playback it simply fails to start.

As you said I am facing issues with the state of source. The sink pad of demux blocks because of the flush. We see GST_FLOW_WRONG_STATE returned to the source. This stalls the source. How can I overcome it? Moving it to ready state -> flush pipeline -> seek to prev playback position sequence isnt working out for me.

Nicolas : The pipeline does flush when we use seek. But the playback restarts from the beginning.

gst_element_seek (pipeline, 1, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_NONE, 0 , GST_SEEK_TYPE_NONE, 0);


Is there anything else that I need to be doing here?

Thanks,
Vikas
Reply | Threaded
Open this post in threaded view
|

Re: Flushing the pipeline in GST 0.10

nightfury
Thank you Tim and Nicholas for the help.  

I am sending the flush start/stop events on to the pad of the element and after doing the below the flush is working file and the pipepline resumes just fine

     1. I had to block on the source pad of the file source so that it does not send data when the pads of demux are not accepting any data.

     2. Send the new segment event after the flush_stop event.
Reply | Threaded
Open this post in threaded view
|

Re: Flushing the pipeline in GST 0.10

amitchawla
Hi ,

How do you send a new segment event to the pipeline after flush_stop?

Actually I am trying to implement a seek across the network. So before starting the sender pipeline, I need to flush the receiver pipeline and tell it to expect a new segment. But I am still not clear how to send a segment event on the receiver pipeline without any filesrc .... it has a tcpserversrc instead ?

Thanks
Amit