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/5681>
This commit is contained in:
Seungha Yang 2023-11-17 01:01:36 +09:00 committed by GStreamer Marge Bot
parent de92a6c7f2
commit d2c9200828

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)) {