avviddec: Unlock stream lock while waiting for decoded frame

FFmpeg might request buffer from other threads, it will result
in deadlock

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2558
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5683>
This commit is contained in:
Seungha Yang 2023-11-17 01:01:36 +09:00 committed by GStreamer Marge Bot
parent e3f6818003
commit f96d05bf52

View file

@ -1779,7 +1779,11 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
* else we might skip a reference frame */
gst_ffmpegviddec_do_qos (ffmpegdec, frame, &mode_switch);
/* FFmpeg might request new buffer from other threads.
* Release lock here */
GST_VIDEO_DECODER_STREAM_UNLOCK (ffmpegdec);
res = avcodec_receive_frame (ffmpegdec->context, ffmpegdec->picture);
GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec);
/* No frames available at this time */
if (res == AVERROR (EAGAIN)) {