From c2f9bcd457b57b6d96a5cbdd9c36272994bc19c3 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 14 Jul 2023 20:56:48 -0700 Subject: cache_frame: fix cache bytes written accounting After making a lengthy recording I noticed this overflow: Cached 17592186042575 MB, from 80475 MB that were received. Average cache compression ratio: -21860206917.2 % This commit fixes the nbytes accumulating minimally by just narrowing its cycle to one iteration, which seems like what was probably intended by whoever wrote this once upon a time. --- src/rmd_cache_frame.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/rmd_cache_frame.c b/src/rmd_cache_frame.c index fce4556..c37f530 100644 --- a/src/rmd_cache_frame.c +++ b/src/rmd_cache_frame.c @@ -90,8 +90,7 @@ void *rmdCacheImageBuffer(ProgData *pdata) blocknum_x = pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH, blocknum_y = pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH, firstrun = 1, - frameno = 0, - nbytes = 0; + frameno = 0; u_int32_t ynum, unum, vnum, y_short_blocks[blocknum_x * blocknum_y], u_short_blocks[blocknum_x * blocknum_y], @@ -108,6 +107,7 @@ void *rmdCacheImageBuffer(ProgData *pdata) exit(13); while (pdata->running) { + int nbytes = 0; FrameHeader fheader; ynum = unum = vnum = 0; @@ -223,8 +223,8 @@ void *rmdCacheImageBuffer(ProgData *pdata) pthread_mutex_unlock(&pdata->yuv_mutex); nbytes += rmdFlushBlock(NULL, 0, 0, 0, 0, icf, 1); + total_bytes += nbytes; } - total_bytes += nbytes; { unsigned int bytes_per_pixel = pdata->specs.depth >= 24 ? 4 : 2; -- cgit v1.2.1