From 59ac88a214589ec1808e2f0f137270f7d114b60c Mon Sep 17 00:00:00 2001 From: chen0088 Date: Wed, 4 Dec 2024 15:32:12 +0800 Subject: [PATCH] modify Signed-off-by: chen0088 --- .../pipeline_node/fpscontroller/fps_controller_process.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp index 190b0faa..98d6b0a5 100644 --- a/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp +++ b/services/data_process/src/pipeline_node/fpscontroller/fps_controller_process.cpp @@ -227,7 +227,10 @@ float FpsControllerProcess::CalculateFrameRate(int64_t nowMs) const int32_t minValidCalculatedFrameRatesNum = 2; int32_t minIncomingFrameNum = targetFrameRate_ / MIN_INCOME_FRAME_NUM_COEFFICIENT; if (validFramesNumber > minIncomingFrameNum && validFramesNumber > minValidCalculatedFrameRatesNum) { - int64_t validTotalTimeInterval = (nowMs - incomingFrameTimesMs_[num - 1]); + int64_t validTotalTimeInterval = 0; + if (num > 0) { + validTotalTimeInterval = (nowMs - incomingFrameTimesMs_[num - 1]); + } if (validTotalTimeInterval < 0) { validTotalTimeInterval = -validTotalTimeInterval; } -- Gitee