Skip to content

Commit

Permalink
Fix offline test with large files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
palana committed Aug 14, 2024
1 parent cb2c7c9 commit d6aebe3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tests/localvocal-offline-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::nanoseconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
Expand Down

0 comments on commit d6aebe3

Please sign in to comment.