Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4772369 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Yuyang Huang
Browse files

LeAudio/CodecExtensibility: Use proper allocated channel counts

The channel count should not be hard-coded, but use the channel
allocation bitmask.

Bug: 308428644
Bug: 313054645
Test: atest bluetooth-test-audio-hal-le-audio-software bluetooth-test-audio-hal-aidl-leaudio-utils bluetooth_le_audio_test bluetooth_le_audio_client_test bluetooth_test_broadcaster bluetooth_test_broadcaster_state_machine bluetooth_le_audio_codec_manager_test
Flag: com.android.bluetooth.flags.leaudio_multicodec_aidl_support
Change-Id: I54bab9050ba02bc88df988a3e3bd0a82d33b8ce2
parent 9887d086
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#include "le_audio_utils.h"

#include <com_android_bluetooth_flags.h>

#include <optional>

#include "hardware/bt_le_audio.h"
@@ -490,6 +492,11 @@ GetCodecConfigSettingFromAidl(
    if (!ase_config->codecConfiguration.empty()) {
      stack_config.params =
          GetStackLeAudioLtvMapFromAidlFormat(ase_config->codecConfiguration);
      auto cfg = stack_config.params.GetAsCoreCodecConfig();
      if (cfg.audio_channel_allocation.has_value()) {
        stack_config.channel_count_per_iso_stream =
            std::bitset<32>(cfg.audio_channel_allocation.value()).count();
      }
    }
  }

+4 −2
Original line number Diff line number Diff line
@@ -394,8 +394,10 @@ PrepareReferenceAseDirectionConfigLc3(bool is_left, bool is_right,
  auto [aidl_metadata, _] = PrepareReferenceMetadata();
  aidl_ase_config.aseConfiguration.metadata = aidl_metadata;

  // FIXME: Seems redundant if audio allocations in .codec.params is mandatory
  // stack_ase_config.codec.channel_count_per_iso_stream = ?
  auto stack_codec_params = stack_params.GetAsCoreCodecConfig();
  stack_ase_config.codec.channel_count_per_iso_stream =
      std::bitset<32>(stack_codec_params.audio_channel_allocation.value_or(1))
          .count();

  /* QoS configuration */
  if (has_qos) {