diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-04-14 01:55:38 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-04-14 01:55:38 +0200 |
commit | 50ff9fb615aa53ece4462bb67e7f4e78acd64847 (patch) | |
tree | ea85fb221a8c7e4581e92e16de886a72ae288626 /src/sound.cpp | |
parent | b554628099c72c0e78e34d04e029695c407be541 (diff) |
Try different pulseaudio options
Diffstat (limited to 'src/sound.cpp')
-rw-r--r-- | src/sound.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index 485548b..4841f70 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -80,7 +80,7 @@ static pa_handle* pa_sound_device_new(const char *server, p->read_length = 0; p->read_index = 0; - const int buffer_size = attr->maxlength; + const int buffer_size = attr->fragsize; void *buffer = malloc(buffer_size); if(!buffer) { fprintf(stderr, "failed to allocate buffer for audio\n"); @@ -123,7 +123,7 @@ static pa_handle* pa_sound_device_new(const char *server, } r = pa_stream_connect_record(p->stream, dev, attr, - (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_ADJUST_LATENCY|PA_STREAM_AUTO_TIMING_UPDATE)); + (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_EARLY_REQUESTS|PA_STREAM_START_UNMUTED|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_DONT_MOVE)); if (r < 0) { error = pa_context_errno(p->context); @@ -255,8 +255,8 @@ int sound_device_get_by_name(SoundDevice *device, const char *device_name, const buffer_attr.tlength = -1; buffer_attr.prebuf = -1; buffer_attr.minreq = -1; - buffer_attr.maxlength = period_frame_size * audio_format_to_get_bytes_per_sample(audio_format) * num_channels; // 2/4 bytes/sample, @num_channels channels - buffer_attr.fragsize = buffer_attr.maxlength; + buffer_attr.maxlength = -1; + buffer_attr.fragsize = period_frame_size * audio_format_to_get_bytes_per_sample(audio_format) * num_channels; // 2/4 bytes/sample, @num_channels channels int error = 0; pa_handle *handle = pa_sound_device_new(nullptr, description, device_name, description, &ss, &buffer_attr, &error); |