From 3bbe176e2770de419b7350d5a5ebe2c3c839d712 Mon Sep 17 00:00:00 2001 From: Asd-g <65298684+Asd-g@users.noreply.github.com> Date: Sat, 23 Mar 2024 14:26:53 +0200 Subject: [PATCH] H264: reorder buffer size No need to change it when threads are less than the buffer. Change to max reorder buffer size isn't always appropriate (e.g., source with buffer size of 1). --- common/decode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/decode.c b/common/decode.c index a171b08f..27c195a0 100644 --- a/common/decode.c +++ b/common/decode.c @@ -146,9 +146,9 @@ int open_decoder && thread_count != 1 && av_cpu_count() > 1 ) c->thread_count = 2; - if( codec->id == AV_CODEC_ID_H264 - && c->has_b_frames < 8 ) - c->has_b_frames = 8; + if (codec->id == AV_CODEC_ID_H264 + && (!thread_count) ? av_cpu_count() : thread_count > c->has_b_frames) + c->has_b_frames = FFMIN((c->has_b_frames + 1) << 2, 16); if( codec->wrapper_name && !strcmp( codec->wrapper_name, "cuvid" ) ) c->has_b_frames = 16; /* the maximum decoder latency for AVC and HEVC frame */