-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initialize pa_buffer_attr.maxlength to -1 #102069
Conversation
Not an expert on the audio system so hesitant to do more than having a quick look. Reading the documentation, leaving this property uninitialized seems like a bad idea. Seeing they themselves recommend setting this to -1 so the buffer is allocated with the maximum supported size, this change seems sound. |
@@ -726,6 +726,7 @@ Error AudioDriverPulseAudio::init_input_device() { | |||
int input_buffer_size = input_buffer_frames * spec.channels; | |||
|
|||
pa_buffer_attr attr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest also zeroing the struct so at least we have sane defaults if we end up relying on some of the other struct fields.
pa_buffer_attr attr; | |
pa_buffer_attr attr = {}; |
1bbf8ed
to
b5622e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find! Thanks for looking into this.
Thanks! |
Fixes #102013 (and other long term unreliabilities of the pulseaudio microphone on Linux) by initializing and uninitialized buffer definition attribute to -1 as recommended here: https://maemo.org/api_refs/5.0/5.0-final/pulseaudio/structpa__buffer__attr.html
The other three attributes (tlength, prebuf, minreq) are not used by the recording feature
pa_stream_connect_record()
and probably don't have to be initialized.