fix(logging): incorrect FPS logging (#10921)

* 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 0bb7b9555e7661c72dc3376cf8a001c6fd3758c8.

* 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
This commit is contained in:
Sayed (Tashfi) Nowroz 2025-01-31 16:25:45 -05:00 committed by GitHub
parent f22866f888
commit 0302b4db47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -281,6 +281,8 @@ static esp_err_t stream_handler(httpd_req_t *req) {
int64_t fr_end = esp_timer_get_time(); int64_t fr_end = esp_timer_get_time();
int64_t frame_time = fr_end - last_frame; int64_t frame_time = fr_end - last_frame;
last_frame = fr_end;
frame_time /= 1000; frame_time /= 1000;
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time); uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time);