rtponviftimestamp: Use gst_segment_to_stream_time_full()

In the situation where playback starts from a keyframe before
the target playback segment, then the first buffers will be
outside the configured segment and gst_segment_to_stream_time()
will return GST_CLOCK_TIME_NONE unconditionally.

If drop-out-of-segment is false, the RTP buffers will not be
dropped, but will be sent witout ONVIF extension timestamps
and given GST_CLOCK_TIME_NONE timestamps on the receiver.

Instead, use gst_segment_to_stream_time_full() to extrapolate
stream time outside the segment so that such buffers still
get assigned their correct timestamps on the receiver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
This commit is contained in:
Jan Schmidt 2024-02-28 09:30:33 +11:00 committed by GStreamer Marge Bot
parent 4b107b60e7
commit 8356bd04a8

View file

@ -538,11 +538,15 @@ get_utc_from_offset (GstRtpOnvifTimestamp * self, GstBuffer * buf)
guint64 time = GST_CLOCK_TIME_NONE;
if (GST_BUFFER_PTS_IS_VALID (buf)) {
time = gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME,
GST_BUFFER_PTS (buf));
if (gst_segment_to_stream_time_full (&self->segment, GST_FORMAT_TIME,
GST_BUFFER_PTS (buf), &time) < 0) {
time = GST_CLOCK_TIME_NONE;
}
} else if (GST_BUFFER_DTS_IS_VALID (buf)) {
time = gst_segment_to_stream_time (&self->segment, GST_FORMAT_TIME,
GST_BUFFER_DTS (buf));
if (gst_segment_to_stream_time_full (&self->segment, GST_FORMAT_TIME,
GST_BUFFER_DTS (buf), &time) < 0) {
time = GST_CLOCK_TIME_NONE;
}
} else {
g_assert_not_reached ();
}