lavc/hevcdec: unbreak WPP/progress2 code

The "progress2" API in pthread_slice.c currently associates a progress
value with a thread rather than a job, relying on the broken assumption
that a job's thread number is equal to its job number modulo thread
count.

This removes this API entirely, and changes hevcdec to use a
ThreadProgress-based implementation that associates a
mutex/cond/progress value with every job.

Fixes races and deadlocks in hevdec with slice threading, e.g. some of
those mentioned in #11221.
This commit is contained in:
Anton Khirnov 2024-10-10 16:01:21 +02:00
parent c50f79a0dc
commit 79c47dfd25
5 changed files with 46 additions and 139 deletions

View file

@ -913,25 +913,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx)
{
return 1;
}
int ff_slice_thread_init_progress(AVCodecContext *avctx)
{
return 0;
}
int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
{
return 0;
}
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
{
}
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
{
}
#endif
const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,