From 8356bd04a87c32ae305190c00cce33526c4bc6fc Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Wed, 28 Feb 2024 09:30:33 +1100 Subject: [PATCH] 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: --- .../gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c b/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c index 83f59da256..ef02cd7e5e 100644 --- a/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c +++ b/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c @@ -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 (); }