From ec9ddb6222e04cda0d3506e8c9e910dc8c44dc36 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 28 Jul 2023 00:39:46 +0900 Subject: [PATCH] rtponviftimestamp: Fix drop-out-of-segment=false mode Fixing unexpected buffer dropping and flow error in case that: * use-reference-timestamps=false * drop-out-of-segment=false * Calculated utc offset is not valid because buffer is out-of-segment The above case should be considered as a valid data flow without returning errors. Fixing regression introduced by https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1683 Part-of: --- .../gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c b/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c index 5070666..83f59da 100644 --- a/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c +++ b/subprojects/gst-plugins-bad/gst/onvif/gstrtponviftimestamp.c @@ -632,27 +632,24 @@ handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf) } } else if (GST_BUFFER_PTS_IS_VALID (buf) || GST_BUFFER_DTS_IS_VALID (buf)) { time = get_utc_from_offset (self, buf); - if (self->prop_drop_out_of_segment && time == GST_CLOCK_TIME_NONE) { - GST_ERROR_OBJECT (self, "Failed to get stream time"); - gst_rtp_buffer_unmap (&rtp); - return FALSE; - } } else { GST_INFO_OBJECT (self, "Buffer doesn't contain any valid DTS or PTS timestamp"); goto done; } - if (time == GST_CLOCK_TIME_NONE) { - GST_ERROR_OBJECT (self, "failed calculating timestamp"); + if (self->prop_drop_out_of_segment && !GST_CLOCK_TIME_IS_VALID (time)) { + GST_ERROR_OBJECT (self, "Failed to get stream time"); gst_rtp_buffer_unmap (&rtp); return FALSE; } /* convert to NTP time. upper 32 bits should contain the seconds * and the lower 32 bits, the fractions of a second. */ - time = gst_util_uint64_scale (time, (G_GINT64_CONSTANT (1) << 32), - GST_SECOND); + if (GST_CLOCK_TIME_IS_VALID (time)) { + time = gst_util_uint64_scale (time, (G_GINT64_CONSTANT (1) << 32), + GST_SECOND); + } GST_DEBUG_OBJECT (self, "timestamp: %" G_GUINT64_FORMAT, time); -- 2.7.4