From e8b2d7a85ba4f747a6752b708744f9a27c4c80e5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 11 Aug 2015 04:43:07 +0200 Subject: [PATCH] fix coreaudio half-duplex buffersize query --- libs/backends/coreaudio/coreaudio_backend.cc | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 85bd2355bc..1eb55ca61e 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -237,11 +237,27 @@ CoreAudioBackend::available_sample_rates (const std::string&) const } std::vector -CoreAudioBackend::available_buffer_sizes (const std::string& device) const +CoreAudioBackend::available_buffer_sizes (const std::string&) const { std::vector bs; - _pcmio->available_buffer_sizes(name_to_id(device), bs); - return bs; + std::vector bs_in; + std::vector bs_out; + const uint32_t inp = name_to_id(_input_audio_device); + const uint32_t out = name_to_id(_output_audio_device); + if (inp == UINT32_MAX && out == UINT32_MAX) { + return bs; + } else if (inp == UINT32_MAX) { + _pcmio->available_buffer_sizes(out, bs_out); + return bs_out; + } else if (out == UINT32_MAX) { + _pcmio->available_buffer_sizes(out, bs_in); + return bs_in; + } else { + _pcmio->available_buffer_sizes(inp, bs_in); + _pcmio->available_buffer_sizes(out, bs_out); + std::set_intersection(bs_in.begin(), bs_in.end(), bs_out.begin(), bs_out.end(), std::back_inserter(bs)); + return bs; + } } uint32_t