On 2014-01-06 08:36:41 +0100, Anton Khirnov wrote:
> 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);
> + }
please add a comment that it is don to avoid deadlocks in broken files
> 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 {
those two look not totally wrong, have you checked if the deadlocks go away
if you mark them finished properly (just the appropiate fields, last mb_row
instead of INT_MAX)?
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel