From d6aebe347ca7fee9adf0edde15f92073b43bc7de Mon Sep 17 00:00:00 2001 From: Ruwen Hahn Date: Wed, 14 Aug 2024 13:41:51 +0200 Subject: [PATCH] Fix offline test with large files In ``` circlebuf_push_back( &gf->input_buffers[c], audio[c].data() + frames_count * frame_size_bytes, frames_size_bytes); ``` `frames_count * frame_size_bytes` would overflow with `int` on a 4 hour file; using `size_t` (on a 64 bit platform) fixes that --- src/tests/localvocal-offline-test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/localvocal-offline-test.cpp b/src/tests/localvocal-offline-test.cpp index 743ffd8..9d8f9d8 100644 --- a/src/tests/localvocal-offline-test.cpp +++ b/src/tests/localvocal-offline-test.cpp @@ -473,10 +473,10 @@ int wmain(int argc, wchar_t *argv[]) obs_log(LOG_INFO, "Sending samples to whisper buffer"); // 25 ms worth of frames - int frames = gf->sample_rate * window_size_in_ms.count() / 1000; + size_t frames = gf->sample_rate * window_size_in_ms.count() / 1000; const int frame_size_bytes = sizeof(float); - int frames_size_bytes = frames * frame_size_bytes; - int frames_count = 0; + size_t frames_size_bytes = frames * frame_size_bytes; + size_t frames_count = 0; int64_t start_time = std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch()) .count();