From bb726c7eefd59cd67890aae8c7bcf4edc8b8e183 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Fri, 31 May 2024 13:07:51 +0200 Subject: [PATCH] codectimestamper: never set DTS to NONE If we want to avoid the DTS going backward, then we can set DTS to last_dts as a last resort. Log a warning in this case Part-of: --- .../gst/codectimestamper/gstcodectimestamper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c index c30f88d5c3..14ac71580b 100644 --- a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c +++ b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c @@ -444,8 +444,11 @@ gst_codec_timestamper_output_frame (GstCodecTimestamper * self, if (dts > frame->pts) { if (frame->pts >= priv->last_dts) dts = frame->pts; - else - dts = GST_CLOCK_TIME_NONE; + else { + GST_WARNING_OBJECT (self, + "Setting DTS to last DTS to avoid PTS < DTS and backward DTS"); + dts = priv->last_dts; + } } if (GST_CLOCK_TIME_IS_VALID (dts))