Skip to content

Commit

Permalink
fix(logging): incorrect FPS logging (#10921)
Browse files Browse the repository at this point in the history
* fix(logging): Corrected FPS calculation

Previously, last_frame was only updated once at the beginning of stream_handler,
leading to incorrect FPS and avg_frame_time computation.

This commit ensures last_frame is updated on each iteration after last FPS computation,
resulting in accurate FPS logging.

Fixes #10920

* Revert "fix(logging): Corrected FPS calculation"

This reverts commit 0bb7b95.

* fix(loggin): Incorrect FPS computation fixed

Corrected and tested change in FPS computation, suggested by @me-no-dev and found working with correct numbers.

Previously, last_frame was only updated once at the beginning of stream_handler,
leading to incorrect FPS and avg_frame_time computation.

This commit ensures last_frame is updated on each iteration after last FPS computation,
resulting in accurate FPS logging.

Fixes #10920
  • Loading branch information
TNeutron authored Jan 31, 2025
1 parent f22866f commit 0302b4d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ static esp_err_t stream_handler(httpd_req_t *req) {
int64_t fr_end = esp_timer_get_time();

int64_t frame_time = fr_end - last_frame;
last_frame = fr_end;

frame_time /= 1000;
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time);
Expand Down

0 comments on commit 0302b4d

Please sign in to comment.