diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-06-05 11:57:37 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-05 11:57:37 +0200 |
commit | b81cb99d9fea5dbe0c1d74008186ef328c7f1a13 (patch) | |
tree | 0570cbd2d0c8335b378be28367c8e7f59742c989 | |
parent | 172f9c9823bdee1aef9c824897992ffb961adbee (diff) | |
download | gst-libav-b81cb99d9fea5dbe0c1d74008186ef328c7f1a13.tar.gz |
avviddec: Release stream lock while calling avcodec_decode_video2()
It might call back into us from another thread and try to take the stream lock
again, e.g. to allocate a buffer.
https://bugzilla.gnome.org/show_bug.cgi?id=726020
-rw-r--r-- | ext/libav/gstavviddec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 18e5439..94bd368 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1259,8 +1259,15 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec, "copy pal %p %p", &packet, pal); } + /* This might call into get_buffer() from another thread, + * which would cause a deadlock. Release the lock here + * and taking it again later seems safe + * See https://bugzilla.gnome.org/show_bug.cgi?id=726020 + */ + GST_VIDEO_DECODER_STREAM_UNLOCK (ffmpegdec); len = avcodec_decode_video2 (ffmpegdec->context, ffmpegdec->picture, have_data, &packet); + GST_VIDEO_DECODER_STREAM_LOCK (ffmpegdec); GST_DEBUG_OBJECT (ffmpegdec, "after decode: len %d, have_data %d", len, *have_data); |