Skip to content

Commit

Permalink
Account for enqueues while in cubeb_audio_dump_stream::write_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Pehrsons committed Feb 12, 2024
1 parent f8e86e2 commit 00563d9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cubeb_audio_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ struct cubeb_audio_dump_stream {

size_t write_all()
{
int available = ringbuffer.available_read();
size_t written = 0;
while (available) {
const int buf_sz = 16 * 1024;
uint8_t buf[buf_sz];
int rv = ringbuffer.dequeue(buf, buf_sz);
available -= rv;
const int buf_sz = 16 * 1024;
uint8_t buf[buf_sz];
while (int rv = ringbuffer.dequeue(buf, buf_sz)) {
written += fwrite(buf, rv, 1, file);
}
return written;
Expand Down

0 comments on commit 00563d9

Please sign in to comment.