Fixes deadlocks when decoding packets containing more than one of the 
aforementioned
slices when using frame threads.

Signed-off-by: James Almer <jamr...@gmail.com>
---
See the discussion in the 
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/241192.html
thread.

Alternative fixes that don't discard the second slice in this scenario welcome.

 libavcodec/hevcdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 967f8f1def..86adab0ae1 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2927,6 +2927,10 @@ static int decode_nal_unit(HEVCContext *s, const 
H2645NAL *nal)
         }
 
         if (s->sh.first_slice_in_pic_flag) {
+            if (s->ref) {
+                av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the 
first in the same frame.\n");
+                goto fail;
+            }
             if (s->max_ra == INT_MAX) {
                 if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) {
                     s->max_ra = s->poc;
-- 
2.21.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to