From e76e98d109e04253ac329f940cacca290e252710 Mon Sep 17 00:00:00 2001 From: Elliot Chen Date: Wed, 31 Aug 2022 11:13:06 +0800 Subject: [PATCH] v4l2videodec: add cap negotiation fail check in the capture configuration change The capture configuration change may cause negotiation fail. Need to check it to avoid enter the endless loop. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c index 7ac17cf..9f6fa7b 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c @@ -684,7 +684,15 @@ gst_v4l2_video_dec_loop (GstVideoDecoder * decoder) ret = gst_v4l2_video_dec_setup_capture (decoder); if (ret != GST_FLOW_OK) { GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); - return; + + /* if caps negotiation failed, avoid trying it repeatly */ + if (ret == GST_FLOW_NOT_NEGOTIATED) { + GST_ERROR_OBJECT (decoder, + "capture configuration change fail, return negotiation fail"); + goto beach; + } else { + return; + } } g_atomic_int_set (&self->capture_configuration_change, FALSE); } -- 2.7.4