videodecoder: Gracefully handle missing data without prior input segment
authorPhilippe Normand <philn@igalia.com>
Mon, 23 Dec 2024 08:49:51 +0000 (09:49 +0100)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Mon, 23 Dec 2024 17:10:23 +0000 (18:10 +0100)
Exit early in case the decoder has been resetted and hasn't received a new
segment event yet.

This was detected with netsim dropping buffers in a WebRTC pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8206>

subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c

index 92f45c23a9a8f948484d53b6b1764cd264254d17..a78b5fd40c4bbf7fad3db623da934f616ba65a4a 100644 (file)
@@ -1307,14 +1307,19 @@ caps_error:
   }
 }
 
+/* Must be called holding the GST_VIDEO_DECODER_STREAM_LOCK */
 static gboolean
-gst_video_decoder_handle_missing_data_default (GstVideoDecoder *
-    decoder, GstClockTime timestamp, GstClockTime duration)
+gst_video_decoder_handle_missing_data_default (GstVideoDecoder * decoder,
+    GstClockTime timestamp, GstClockTime duration)
 {
   GstVideoDecoderPrivate *priv;
 
   priv = decoder->priv;
 
+  /* Exit early in case the decoder has been resetted and hasn't received a new segment event yet. */
+  if (decoder->input_segment.format != GST_FORMAT_TIME)
+    return FALSE;
+
   if (priv->automatic_request_sync_points) {
     GstClockTime deadline =
         gst_segment_to_running_time (&decoder->input_segment, GST_FORMAT_TIME,