Fixes deadlocks.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:[email protected]
---
 libavcodec/h264.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4b10a68..d43b11e 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1857,6 +1857,10 @@ static int h264_frame_start(H264Context *h)
     int i, ret;
     const int pixel_shift = h->pixel_shift;
 
+    if (h->cur_pic_ptr) {
+        ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
+        ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
+    }
     release_unused_pictures(h, 1);
     h->cur_pic_ptr = NULL;
 
@@ -3675,6 +3679,8 @@ static int decode_slice_header(H264Context *h, 
H264Context *h0)
             if (!FIELD_PICTURE(h) || h->picture_structure == 
last_pic_structure) {
                 /* Previous field is unmatched. Don't display it, but let it
                  * remain for reference if marked as such. */
+                ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, 0);
+                ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, 1);
                 h0->cur_pic_ptr = NULL;
                 h0->first_field = FIELD_PICTURE(h);
             } else {
@@ -3682,6 +3688,8 @@ static int decode_slice_header(H264Context *h, 
H264Context *h0)
                     /* This and the previous field had different frame_nums.
                      * Consider this field first in pair. Throw away previous
                      * one except for reference purposes. */
+                    ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, 
0);
+                    ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, 
1);
                     h0->first_field = 1;
                     h0->cur_pic_ptr = NULL;
                 } else {
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to