Reset stream params on init

Without a reset, a duplex stream being reused as an output stream will
open an input stream and provide an input buffer, which is not expected.
This commit is contained in:
Andreas Pehrson 2024-07-04 22:09:12 +02:00
parent 5d5008d25c
commit 714ab57f8f

View file

@ -1293,10 +1293,14 @@ aaudio_stream_init(cubeb * ctx, cubeb_stream ** stream,
if (output_stream_params) { if (output_stream_params) {
stm->output_stream_params = std::make_unique<cubeb_stream_params>(); stm->output_stream_params = std::make_unique<cubeb_stream_params>();
*(stm->output_stream_params) = *output_stream_params; *(stm->output_stream_params) = *output_stream_params;
} else {
stm->output_stream_params = nullptr;
} }
if (input_stream_params) { if (input_stream_params) {
stm->input_stream_params = std::make_unique<cubeb_stream_params>(); stm->input_stream_params = std::make_unique<cubeb_stream_params>();
*(stm->input_stream_params) = *input_stream_params; *(stm->input_stream_params) = *input_stream_params;
} else {
stm->input_stream_params = nullptr;
} }
LOG("cubeb stream prefs: voice_input: %s voice_output: %s", LOG("cubeb stream prefs: voice_input: %s voice_output: %s",