Set the maximum decode threads to be 8.
This will fix the frame parallel decode hang on windows due to not enough semaphores. This will also make the frame parallel decode safer as the number of frame buffers could only support maximum 8 threads. Change-Id: Id9ef50692819dcbebbd74a0aabffbfb3f39a4309
This commit is contained in:
parent
67b61c7ace
commit
dd88f48296
@ -22,6 +22,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Set maximum decode threads to be 8 due to the limit of frame buffers
|
||||
// and not enough semaphores in the emulation layer on windows.
|
||||
#define MAX_DECODE_THREADS 8
|
||||
|
||||
#if CONFIG_MULTITHREAD
|
||||
|
||||
#if defined(_WIN32)
|
||||
@ -103,8 +107,8 @@ static INLINE int pthread_cond_destroy(pthread_cond_t *const condition) {
|
||||
static INLINE int pthread_cond_init(pthread_cond_t *const condition,
|
||||
void* cond_attr) {
|
||||
(void)cond_attr;
|
||||
condition->waiting_sem_ = CreateSemaphore(NULL, 0, 1, NULL);
|
||||
condition->received_sem_ = CreateSemaphore(NULL, 0, 1, NULL);
|
||||
condition->waiting_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL);
|
||||
condition->received_sem_ = CreateSemaphore(NULL, 0, MAX_DECODE_THREADS, NULL);
|
||||
condition->signal_event_ = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (condition->waiting_sem_ == NULL ||
|
||||
condition->received_sem_ == NULL ||
|
||||
|
@ -363,6 +363,8 @@ static vpx_codec_err_t init_decoder(vpx_codec_alg_priv_t *ctx) {
|
||||
ctx->num_cache_frames = 0;
|
||||
ctx->num_frame_workers =
|
||||
(ctx->frame_parallel_decode == 1) ? ctx->cfg.threads: 1;
|
||||
if (ctx->num_frame_workers > MAX_DECODE_THREADS)
|
||||
ctx->num_frame_workers = MAX_DECODE_THREADS;
|
||||
ctx->available_threads = ctx->num_frame_workers;
|
||||
ctx->flushed = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user