videodecoder: Gracefully handle missing data without prior input segment

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/8200>
This commit is contained in:
Philippe Normand 2024-12-23 09:49:51 +01:00 committed by GStreamer Marge Bot
parent 7152d5c07a
commit 17e5491b60

View file

@ -1307,14 +1307,19 @@ caps_error:
} }
} }
/* Must be called holding the GST_VIDEO_DECODER_STREAM_LOCK */
static gboolean static gboolean
gst_video_decoder_handle_missing_data_default (GstVideoDecoder * gst_video_decoder_handle_missing_data_default (GstVideoDecoder * decoder,
decoder, GstClockTime timestamp, GstClockTime duration) GstClockTime timestamp, GstClockTime duration)
{ {
GstVideoDecoderPrivate *priv; GstVideoDecoderPrivate *priv;
priv = decoder->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) { if (priv->automatic_request_sync_points) {
GstClockTime deadline = GstClockTime deadline =
gst_segment_to_running_time (&decoder->input_segment, GST_FORMAT_TIME, gst_segment_to_running_time (&decoder->input_segment, GST_FORMAT_TIME,