avviddec: Drop decoder stream lock when calling send_packet

This is already done for every other calls to send_packet. The deadlock occures
since FFMPeg 6.0. The decoder tries to get a buffer from a thread during
the draining process, and blocks trying to get the video decoder stream lock
already heald by the drain function.

Fixes #2383

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4171>
This commit is contained in:
Nicolas Dufresne 2023-03-14 14:27:39 -04:00 committed by GStreamer Marge Bot
parent 83364c5729
commit 83985ae1fa

View file

@ -2042,8 +2042,12 @@ gst_ffmpegviddec_drain (GstVideoDecoder * decoder)
if (!ffmpegdec->opened)
return GST_FLOW_OK;
if (avcodec_send_packet (ffmpegdec->context, NULL))
GST_VIDEO_DECODER_STREAM_UNLOCK (ffmpegdec);
if (avcodec_send_packet (ffmpegdec->context, NULL)) {
GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec);
goto send_packet_failed;
}
GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec);
do {
got_frame = gst_ffmpegviddec_frame (ffmpegdec, NULL, &ret);