diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-07-14 20:56:48 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-07-14 20:56:48 -0700 |
commit | c2f9bcd457b57b6d96a5cbdd9c36272994bc19c3 (patch) | |
tree | 0d8df0c3697f19ed3e78e1e29451d20a26d7594b /src | |
parent | f8bb20fe7d79c6c1b6ce12c491f9822f788a9c3c (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/rmd_cache_frame.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; |