summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-06-05 11:57:37 +0200
committerTim-Philipp Müller <tim@centricular.com>2015-06-07 18:57:06 +0100
commitac54ee0473f71e0c7fc195883b9ac6ae15f302af (patch)
tree68e5227ae563e2dd5a77a24abb2548e4edec02a6
parent07d185161ea5d543f2ae1c6485da79dd7ee01173 (diff)
avviddec: Release stream lock while calling avcodec_decode_video2()1.4
It might call back into us from another thread and try to take the stream lock again, e.g. to allocate a buffer. Fixes avdec_h265 not outputting anything. https://bugzilla.gnome.org/show_bug.cgi?id=726020
-rw-r--r--ext/libav/gstavviddec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index e2d8245..b876b18 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -1246,8 +1246,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);