aboutsummaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-09-02 00:42:22 +0200
committerdec05eba <dec05eba@protonmail.com>2022-09-02 00:42:22 +0200
commit6ea59acb9e1e268d445d8b1888c390a3e2d792de (patch)
tree3b046a10a3f53f4eb6c467562fc581f9ffaba256 /src/sound.cpp
parentcd69b7813b98ce0a27667d220e2fff7727cae65d (diff)
Make video framerate constant, fix audio desync a bit when no audio playing for a while
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index d177c8e..d0b5033 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -33,7 +33,9 @@ int sound_device_get_by_name(SoundDevice *device, const char *name, unsigned int
int error;
pa_buffer_attr buffer_attr;
- memset(&buffer_attr, -1, sizeof(buffer_attr));
+ buffer_attr.tlength = -1;
+ buffer_attr.prebuf = -1;
+ buffer_attr.minreq = -1;
buffer_attr.maxlength = period_frame_size * 2 * num_channels; // 2 bytes/sample, @num_channels channels
buffer_attr.fragsize = buffer_attr.maxlength;
@@ -66,7 +68,7 @@ void sound_device_close(SoundDevice *device) {
}
int sound_device_read_next_chunk(SoundDevice *device, void **buffer) {
- int error;
+ int error = 0;
if(pa_simple_read((pa_simple*)device->handle, device->buffer, device->buffer_size, &error) < 0) {
fprintf(stderr, "pa_simple_read() failed: %s\n", pa_strerror(error));
return -1;