How to skip frames that came into the pipeline before the RTSP PLAY call?

Zalimkhan Beslaneev zalimkhan.beslaneev at ru.axxonsoft.com
Tue Mar 1 06:54:31 UTC 2022


Hello,

I am new to Gstreamer. I wrote a simple RTSP server that generates a pipeline (gst_rtsp_media_factory_set_launch) like :

appsrc name=vsrc is-live=true do-timestamp=true ! queue ! h264parse ! rtph264pay name=pay0 pt=96

The SDP response is generated after the DESCRIBE request, but only after a few frames on the signal have been received by the appsrc input:

vsrc = gst_bin_get_by_name_recurse_up(GST_BIN(element), "vsrc"); // appsrc
if (nullptr != vsrc)
{
    gst_util_set_object_arg(G_OBJECT(vsrc), "format", "time");
    g_signal_connect(vsrc, "need-data", (GCallback)need_video_data, streamResource);
}

The time from which the video is to be played is passed in the RTSP request PLAY, in the Range header as an absolute:

PLAY rtsp://172.19.9.65:554/Recording/ RTSP/1.0
CSeq: 4
Immediate: yes
Range: clock=20220127T082831.039Z- // Start from ...

To the object GstRTSPClient attached the handler to the signal in which I process this request and make the move to the right time in my appsrc

g_signal_connect(client, "pre-play-request", (GCallback)pre_play_request, NULL);

The problem is that at this point my appsrc's start time frames have already arrived in pipline and I watch them first, and then the playback continues from the time specified in the PLAY request (after seek in my appsrc). Can you please tell me how I can cut off these initial frames that came in before the PLAY call.
I've tried:
1. gst_element_seek - doesn't help because of peculiarities of appsrc implementation
2. Flush didn't help either, tried resetting sink at element rtph264pay:

gst_pad_push_event(sinkPad, gst_event_new_flush_start());
GST_PAD_STREAM_LOCK(sinkPad);
// ... seek in my appsrc
gst_pad_push_event(sinkPad, gst_event_new_flush_stop(TRUE));
GST_PAD_STREAM_UNLOCK(sinkPad);

gst_object_unref(sinkPad);

Thank You!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220301/aa893d05/attachment.htm>


More information about the gstreamer-devel mailing list