how to flush the GstBuffers in pipeline without stop it (GST_STATE_NULL)?

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

how to flush the GstBuffers in pipeline without stop it (GST_STATE_NULL)?

Halley Zhao
Hi expert:

##background:
  I use a simple gst pipeline (appsrc->v4l2h264decode->waylandsink) inside a bigger pipeline of my own (not gst framework, handles demux, audio etc).
## issue
  I meet issue for seek.  when I seek backward (sometime before current time), the clock is reset to a previous time and new buffer comes with smaller pts. but the cached buffer in gst pipeline has a bigger pts than new clock time, video rendering will be blocked for long time.
  is there any decent way to overcome this?
  I think the possible solution may flush the cached buffer during seek, but I don't find a quick way to do so.

_______________________________________________
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 flush the GstBuffers in pipeline without stop it (GST_STATE_NULL)?

Nicolas Dufresne-5


Le mer. 29 mai 2019 07 h 40, Halley Zhao <[hidden email]> a écrit :
Hi expert:

##background:
  I use a simple gst pipeline (appsrc->v4l2h264decode->waylandsink) inside a bigger pipeline of my own (not gst framework, handles demux, audio etc).
## issue
  I meet issue for seek.  when I seek backward (sometime before current time), the clock is reset to a previous time and new buffer comes with smaller pts. but the cached buffer in gst pipeline has a bigger pts than new clock time, video rendering will be blocked for long time.
  is there any decent way to overcome this?
  I think the possible solution may flush the cached buffer during seek, but I don't find a quick way to do so.

Flushing seeks should already have this effect. Sounds like some bug somewhere.

_______________________________________________
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 flush the GstBuffers in pipeline without stop it (GST_STATE_NULL)?

Halley Zhao
for my pipeline, appsrc-->video_decode-->video_sink;
seems appsrc doesn't support seek, so the flush is ignored as well. is there any way to flush appsrc?
0:00:12.615868250 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2071:gst_base_src_default_event:<my_appsrc> is not seekable
0:00:12.615988375 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2099:gst_base_src_event:<my_appsrc> subclass refused event


0:00:12.614262000 18152 0xffff94003c00 INFO               GST_EVENT gstevent.c:1274:gst_event_new_seek: creating seek rate 1.000000, format TIME, flags 1, start_type 1, start 0:00:01.000000000, stop_type 1, stop 99:99:99.999999999
0:00:12.614379625 18152 0xffff94003c00 DEBUG              GST_EVENT gstevent.c:306:gst_event_new_custom: creating new event 0xffff94165020 seek 51201
0:00:12.614425250 18152 0xffff94003c00 DEBUG       GST_ELEMENT_PADS gstelement.c:1856:gst_element_send_event: send seek event on element pipeline
0:00:12.614498750 18152 0xffff94003c00 DEBUG                    bin gstbin.c:3137:gst_bin_send_event:<pipeline> Sending seek event to sink children
0:00:12.614555500 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vconvert is not sink
0:00:12.614608250 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vsink is sink
0:00:12.614689250 18152 0xffff94003c00 DEBUG       GST_ELEMENT_PADS gstelement.c:1856:gst_element_send_event: send seek event on element my_vsink
0:00:12.614744250 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4470:gst_base_sink_send_event:<my_vsink> handling event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                      format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.614905375 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4509:gst_base_sink_send_event:<my_vsink> sending event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                       format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615035500 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_vconvert:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                              format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615161500 18152 0xffff94003c00 DEBUG          basetransform gstbasetransform.c:1941:gst_base_transform_src_eventfunc:<my_vconvert> handling event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,      format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615283625 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_vdec:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                                  format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615402000 18152 0xffff94003c00 DEBUG           videodecoder gstvideodecoder.c:1584:gst_video_decoder_src_event:<my_vdec> received event 51201, seek
0:00:12.615448375 18152 0xffff94003c00 DEBUG           videodecoder gstvideodecoder.c:1485:gst_video_decoder_src_event_default:<my_vdec> received event 51201, seek
0:00:12.615502625 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_appsrc:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                                format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615618125 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2027:gst_base_src_default_event:<my_appsrc> handle event seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1, format=(GstFormat)GST_FORMAT_TIME,  flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615868250 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2071:gst_base_src_default_event:<my_appsrc> is not seekable
0:00:12.615988375 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2099:gst_base_src_event:<my_appsrc> subclass refused event
0:00:12.616034625 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_appsrc:src> sent event, ret error
0:00:12.616085625 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_vdec:src> sent event, ret error
0:00:12.616131500 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_vconvert:src> sent event, ret error
0:00:12.616173625 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4518:gst_base_sink_send_event:<my_vsink> handled event: 0
0:00:12.616224875 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vdec is not sink
0:00:12.616276500 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_appsrc is not sink
0:00:12.616330875 18152 0xffff94003c00 DEBUG                    bin gstbin.c:3177:gst_bin_send_event:<pipeline> Sending seek event to src pads

Nicolas Dufresne <[hidden email]> 于2019年5月29日周三 下午8:55写道:


Le mer. 29 mai 2019 07 h 40, Halley Zhao <[hidden email]> a écrit :
Hi expert:

##background:
  I use a simple gst pipeline (appsrc->v4l2h264decode->waylandsink) inside a bigger pipeline of my own (not gst framework, handles demux, audio etc).
## issue
  I meet issue for seek.  when I seek backward (sometime before current time), the clock is reset to a previous time and new buffer comes with smaller pts. but the cached buffer in gst pipeline has a bigger pts than new clock time, video rendering will be blocked for long time.
  is there any decent way to overcome this?
  I think the possible solution may flush the cached buffer during seek, but I don't find a quick way to do so.

Flushing seeks should already have this effect. Sounds like some bug somewhere.

_______________________________________________
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

_______________________________________________
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 flush the GstBuffers in pipeline without stop it (GST_STATE_NULL)?

Halley Zhao
I'm trying the following code, seems not work yet:

    gboolean ret = FALSE;
    GstEvent *flush_start, *flush_stop;

    DEBUG("flushing pipeline...");
    flush_start = gst_event_new_flush_start();
    flush_stop = gst_event_new_flush_stop(FALSE);

    ret = gst_element_send_event(GST_ELEMENT(mGstPipeline), flush_start);
    if (!ret)
      WARNING("failed to send flush-start event");
    ret = gst_element_send_event(GST_ELEMENT(mGstPipeline), flush_stop);
    if (!ret)
      WARNING("failed to send flush-stop event");

Halley Zhao <[hidden email]> 于2019年6月3日周一 下午5:48写道:
for my pipeline, appsrc-->video_decode-->video_sink;
seems appsrc doesn't support seek, so the flush is ignored as well. is there any way to flush appsrc?
0:00:12.615868250 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2071:gst_base_src_default_event:<my_appsrc> is not seekable
0:00:12.615988375 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2099:gst_base_src_event:<my_appsrc> subclass refused event


0:00:12.614262000 18152 0xffff94003c00 INFO               GST_EVENT gstevent.c:1274:gst_event_new_seek: creating seek rate 1.000000, format TIME, flags 1, start_type 1, start 0:00:01.000000000, stop_type 1, stop 99:99:99.999999999
0:00:12.614379625 18152 0xffff94003c00 DEBUG              GST_EVENT gstevent.c:306:gst_event_new_custom: creating new event 0xffff94165020 seek 51201
0:00:12.614425250 18152 0xffff94003c00 DEBUG       GST_ELEMENT_PADS gstelement.c:1856:gst_element_send_event: send seek event on element pipeline
0:00:12.614498750 18152 0xffff94003c00 DEBUG                    bin gstbin.c:3137:gst_bin_send_event:<pipeline> Sending seek event to sink children
0:00:12.614555500 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vconvert is not sink
0:00:12.614608250 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vsink is sink
0:00:12.614689250 18152 0xffff94003c00 DEBUG       GST_ELEMENT_PADS gstelement.c:1856:gst_element_send_event: send seek event on element my_vsink
0:00:12.614744250 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4470:gst_base_sink_send_event:<my_vsink> handling event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                      format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.614905375 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4509:gst_base_sink_send_event:<my_vsink> sending event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                       format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615035500 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_vconvert:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                              format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615161500 18152 0xffff94003c00 DEBUG          basetransform gstbasetransform.c:1941:gst_base_transform_src_eventfunc:<my_vconvert> handling event 0xffff94165020 seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,      format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615283625 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_vdec:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                                  format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615402000 18152 0xffff94003c00 DEBUG           videodecoder gstvideodecoder.c:1584:gst_video_decoder_src_event:<my_vdec> received event 51201, seek
0:00:12.615448375 18152 0xffff94003c00 DEBUG           videodecoder gstvideodecoder.c:1485:gst_video_decoder_src_event_default:<my_vdec> received event 51201, seek
0:00:12.615502625 18152 0xffff94003c00 DEBUG              GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<my_appsrc:src> have event type seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1,                                format=(GstFormat)GST_FORMAT_TIME, flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615618125 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2027:gst_base_src_default_event:<my_appsrc> handle event seek event: 0xffff94165020, time 99:99:99.999999999, seq-num 152, GstEventSeek, rate=(double)1, format=(GstFormat)GST_FORMAT_TIME,  flags=(GstSeekFlags)GST_SEEK_FLAG_FLUSH, cur-type=(GstSeekType)GST_SEEK_TYPE_SET, cur=(gint64)1000000000, stop-type=(GstSeekType)GST_SEEK_TYPE_SET, stop=(gint64)-1;
0:00:12.615868250 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2071:gst_base_src_default_event:<my_appsrc> is not seekable
0:00:12.615988375 18152 0xffff94003c00 DEBUG                basesrc gstbasesrc.c:2099:gst_base_src_event:<my_appsrc> subclass refused event
0:00:12.616034625 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_appsrc:src> sent event, ret error
0:00:12.616085625 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_vdec:src> sent event, ret error
0:00:12.616131500 18152 0xffff94003c00 DEBUG               GST_PADS gstpad.c:5712:gst_pad_send_event_unchecked:<my_vconvert:src> sent event, ret error
0:00:12.616173625 18152 0xffff94003c00 DEBUG               basesink gstbasesink.c:4518:gst_base_sink_send_event:<my_vsink> handled event: 0
0:00:12.616224875 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_vdec is not sink
0:00:12.616276500 18152 0xffff94003c00 DEBUG             GST_STATES gstbin.c:1969:bin_element_is_sink:<pipeline> child my_appsrc is not sink
0:00:12.616330875 18152 0xffff94003c00 DEBUG                    bin gstbin.c:3177:gst_bin_send_event:<pipeline> Sending seek event to src pads

Nicolas Dufresne <[hidden email]> 于2019年5月29日周三 下午8:55写道:


Le mer. 29 mai 2019 07 h 40, Halley Zhao <[hidden email]> a écrit :
Hi expert:

##background:
  I use a simple gst pipeline (appsrc->v4l2h264decode->waylandsink) inside a bigger pipeline of my own (not gst framework, handles demux, audio etc).
## issue
  I meet issue for seek.  when I seek backward (sometime before current time), the clock is reset to a previous time and new buffer comes with smaller pts. but the cached buffer in gst pipeline has a bigger pts than new clock time, video rendering will be blocked for long time.
  is there any decent way to overcome this?
  I think the possible solution may flush the cached buffer during seek, but I don't find a quick way to do so.

Flushing seeks should already have this effect. Sounds like some bug somewhere.

_______________________________________________
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel