aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndreas Pehrson <[email protected]>2023-10-10 12:09:54 +0200
committerPaul Adenot <[email protected]>2024-04-16 16:31:18 +0200
commitb82e270abf5391afbb84f7fb678ae5ebe4a6eb13 (patch)
tree448c00282fd8c13b9ebdb7398ad3bcbf7da13ef8
parenta6752d6ffe33994c757a6134524cf201c5c63cba (diff)
downloadcubeb-b82e270abf5391afbb84f7fb678ae5ebe4a6eb13.tar.gz
cubeb-b82e270abf5391afbb84f7fb678ae5ebe4a6eb13.zip
Account for enqueues while in cubeb_audio_dump_stream::write_all
-rw-r--r--src/cubeb_audio_dump.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/cubeb_audio_dump.cpp b/src/cubeb_audio_dump.cpp
index 8de3d88..a290ff2 100644
--- a/src/cubeb_audio_dump.cpp
+++ b/src/cubeb_audio_dump.cpp
@@ -64,13 +64,10 @@ public:
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;