diff options
author | Paul Adenot <[email protected]> | 2023-11-09 11:11:58 +0100 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2023-11-10 11:31:35 +0100 |
commit | 72ded59b4d084e9dc4a8324b67ff7b98c7b88ab3 (patch) | |
tree | 5d6835954966a54c6ae0cd4d38c1ccd120cbd308 | |
parent | a0e8b8e49aac3dc84000c250508300333c86e869 (diff) | |
download | cubeb-72ded59b4d084e9dc4a8324b67ff7b98c7b88ab3.tar.gz cubeb-72ded59b4d084e9dc4a8324b67ff7b98c7b88ab3.zip |
Fix output buffer conversion: handle differing channel count between input and output
-rw-r--r-- | src/cubeb_opensl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cubeb_opensl.cpp b/src/cubeb_opensl.cpp index 6f3c7bd..4115050 100644 --- a/src/cubeb_opensl.cpp +++ b/src/cubeb_opensl.cpp @@ -592,6 +592,8 @@ player_fullduplex_callback(SLBufferQueueItf caller, void * user_ptr) long input_frame_count = stm->input_buffer_length / stm->input_frame_size; long sample_count = input_frame_count * stm->input_params->channels; long frames_needed = stm->queuebuf_len / stm->framesize; + uint32_t output_sample_count = + stm->output_params->channels * stm->queuebuf_len / stm->framesize; if (!input_buffer) { LOG("Input hole set silent input buffer"); @@ -601,7 +603,7 @@ player_fullduplex_callback(SLBufferQueueItf caller, void * user_ptr) input_buffer = convert_input_buffer_if_needed(stm, input_buffer, sample_count); - output_buffer = get_output_buffer(stm, output_buffer, sample_count); + output_buffer = get_output_buffer(stm, output_buffer, output_sample_count); long written = 0; // Trigger user callback through resampler |