From 30b97479387e46911f5e5d2955860bfb753770b8 Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin Date: Tue, 27 Feb 2024 18:48:31 +0100 Subject: [PATCH] Only add frame based threading delay if frame based threading is actually used --- src/core/videosource.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/videosource.cpp b/src/core/videosource.cpp index 385f989525..8577a5bda7 100644 --- a/src/core/videosource.cpp +++ b/src/core/videosource.cpp @@ -247,7 +247,9 @@ FFMS_VideoSource::FFMS_VideoSource(const char *SourceFile, FFMS_Index &Index, in Delay = CodecContext->delay; } else { // In theory we can move this to CodecContext->delay, sort of, one day, maybe. Not now. - Delay = CodecContext->has_b_frames + (CodecContext->thread_count - 1); // Normal decoder delay + Delay = CodecContext->has_b_frames; // Normal decoder delay + if (CodecContext->active_thread_type & FF_THREAD_FRAME) // Adjust for frame based threading + Delay += CodecContext->thread_count - 1; } // Always try to decode a frame to make sure all required parameters are known