diff options
author | Jakub Pawlowski <jpawlowski@google.com> | 2022-05-06 09:58:04 +0200 |
---|---|---|
committer | Jakub Pawlowski <jpawlowski@google.com> | 2022-05-11 08:49:12 +0200 |
commit | 780d8c5ab6a40e36c790d19303cfbc8ee99af3b5 (patch) | |
tree | 61589f23faeec2d76cfab0fec60d10d555706056 /bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp | |
parent | abc4ffe565f277a3350f8bfe045ec439f00558de (diff) |
Bluetooth LE Audio: pass the 24 bit stream as unpacked through HAL
LC3 encoder/decoder expects unpacked 24 bit stream
Bug: 230578655
Test: use 24_2 configuration to play over LE Audio
Merged-In: I298d6d3a0cd9786581730de88487c982e1fa9d9d
Change-Id: I298d6d3a0cd9786581730de88487c982e1fa9d9d
Diffstat (limited to 'bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp')
-rw-r--r-- | bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp index 911c9282eb..c16ff54dda 100644 --- a/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/LeAudioSoftwareAudioProvider.cpp @@ -91,17 +91,21 @@ ndk::ScopedAStatus LeAudioSoftwareAudioProvider::startSession( else if (session_type_ == SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH) buffer_modifier = kBufferInCount; + // 24 bit audio stream is sent as unpacked + int bytes_per_sample = + (pcm_config.bitsPerSample == 24) ? 4 : (pcm_config.bitsPerSample / 8); + uint32_t data_mq_size = (ceil(pcm_config.sampleRateHz) / 1000) * - channel_mode_to_channel_count(pcm_config.channelMode) * - (pcm_config.bitsPerSample / 8) * (pcm_config.dataIntervalUs / 1000) * - buffer_modifier; + channel_mode_to_channel_count(pcm_config.channelMode) * bytes_per_sample * + (pcm_config.dataIntervalUs / 1000) * buffer_modifier; if (data_mq_size <= 0) { LOG(ERROR) << __func__ << "Unexpected audio buffer size: " << data_mq_size << ", SampleRateHz: " << pcm_config.sampleRateHz << ", ChannelMode: " << toString(pcm_config.channelMode) << ", BitsPerSample: " << static_cast<int>(pcm_config.bitsPerSample) + << ", BytesPerSample: " << bytes_per_sample << ", DataIntervalUs: " << pcm_config.dataIntervalUs << ", SessionType: " << toString(session_type_); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); |