v4l2videodec: safely retrun from video_dec_loop with stream unlock
authorHou Qi <qi.hou@nxp.com>
Tue, 15 Mar 2022 01:49:59 +0000 (09:49 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 16 Mar 2022 02:13:00 +0000 (02:13 +0000)
This is to avoid decoder hang when doing trick play between
different resolutions.

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

subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c

index 674e3c1..9d9cc1b 100644 (file)
@@ -655,8 +655,10 @@ gst_v4l2_video_dec_loop (GstVideoDecoder * decoder)
   if (g_atomic_int_get (&self->capture_configuration_change)) {
     gst_v4l2_object_stop (self->v4l2capture);
     ret = gst_v4l2_video_dec_setup_capture (decoder);
-    if (ret != GST_FLOW_OK)
+    if (ret != GST_FLOW_OK) {
+      GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
       return;
+    }
     g_atomic_int_set (&self->capture_configuration_change, FALSE);
   }
   GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);