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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6977>
This commit is contained in:
Mathieu Duponchelle 2024-05-31 13:07:51 +02:00 committed by GStreamer Marge Bot
parent 27662d5fb8
commit deed29732b

View file

@ -444,8 +444,11 @@ gst_codec_timestamper_output_frame (GstCodecTimestamper * self,
if (dts > frame->pts) { if (dts > frame->pts) {
if (frame->pts >= priv->last_dts) if (frame->pts >= priv->last_dts)
dts = frame->pts; dts = frame->pts;
else else {
dts = GST_CLOCK_TIME_NONE; 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)) if (GST_CLOCK_TIME_IS_VALID (dts))