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

Commit 5558bf9b authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Łukasz Rymanowski
Browse files

LeAudio: Improve data path setup

The data path configuration should be provided by the audio set
configuration provider. For now, these are based on the current
codec location (either HOST or ADSP). In future this should
be provided from the vendor interface over the AIDL.

Bug: 295972694
Test: atest bluetooth_le_audio_test bluetooth_le_audio_client_test bluetooth_test_broadcaster bluetooth_test_broadcaster_state_machine
Change-Id: If39a1d1ac089f236e4ed9258644c197a57f1e723
parent 565f4ad6
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -69,8 +69,7 @@ static std::unordered_map<


struct codec_manager_impl {
struct codec_manager_impl {
 public:
 public:
  codec_manager_impl(
  codec_manager_impl() {
      const std::vector<btle_audio_codec_config_t>& offloading_preference) {
    offload_enable_ = osi_property_get_bool(
    offload_enable_ = osi_property_get_bool(
                          "ro.bluetooth.leaudio_offload.supported", false) &&
                          "ro.bluetooth.leaudio_offload.supported", false) &&
                      !osi_property_get_bool(
                      !osi_property_get_bool(
@@ -96,7 +95,10 @@ struct codec_manager_impl {
    btm_configure_data_path(btm_data_direction::CONTROLLER_TO_HOST,
    btm_configure_data_path(btm_data_direction::CONTROLLER_TO_HOST,
                            kIsoDataPathPlatformDefault, {});
                            kIsoDataPathPlatformDefault, {});
    SetCodecLocation(CodecLocation::ADSP);
    SetCodecLocation(CodecLocation::ADSP);
    le_audio::AudioSetConfigurationProvider::Initialize();
  }
  void start(
      const std::vector<btle_audio_codec_config_t>& offloading_preference) {
    le_audio::AudioSetConfigurationProvider::Initialize(GetCodecLocation());
    UpdateOffloadCapability(offloading_preference);
    UpdateOffloadCapability(offloading_preference);
  }
  }
  ~codec_manager_impl() {
  ~codec_manager_impl() {
@@ -413,8 +415,8 @@ struct CodecManager::impl {
  void Start(
  void Start(
      const std::vector<btle_audio_codec_config_t>& offloading_preference) {
      const std::vector<btle_audio_codec_config_t>& offloading_preference) {
    LOG_ASSERT(!codec_manager_impl_);
    LOG_ASSERT(!codec_manager_impl_);
    codec_manager_impl_ =
    codec_manager_impl_ = std::make_unique<codec_manager_impl>();
        std::make_unique<codec_manager_impl>(offloading_preference);
    codec_manager_impl_->start(offloading_preference);
  }
  }


  void Stop() {
  void Stop() {
+2 −0
Original line number Original line Diff line number Diff line
@@ -1583,6 +1583,8 @@ bool LeAudioDevice::ConfigureAses(
  for (; needed_ase && ase; needed_ase--) {
  for (; needed_ase && ase; needed_ase--) {
    ase->active = true;
    ase->active = true;
    ase->configured_for_context_type = context_type;
    ase->configured_for_context_type = context_type;
    ase->is_codec_in_controller = ent.is_codec_in_controller;
    ase->data_path_id = ent.data_path_id;
    active_ases++;
    active_ases++;


    /* In case of late connect, we could be here for STREAMING ase.
    /* In case of late connect, we could be here for STREAMING ase.
+2 −1
Original line number Original line Diff line number Diff line
@@ -431,7 +431,8 @@ class LeAudioAseConfigurationTest : public Test {
    group_ = new LeAudioDeviceGroup(group_id_);
    group_ = new LeAudioDeviceGroup(group_id_);
    bluetooth::manager::SetMockBtmInterface(&btm_interface_);
    bluetooth::manager::SetMockBtmInterface(&btm_interface_);
    controller::SetMockControllerInterface(&controller_interface_);
    controller::SetMockControllerInterface(&controller_interface_);
    ::le_audio::AudioSetConfigurationProvider::Initialize();
    ::le_audio::AudioSetConfigurationProvider::Initialize(
        ::le_audio::types::CodecLocation::ADSP);
    MockCsisClient::SetMockInstanceForTesting(&mock_csis_client_module_);
    MockCsisClient::SetMockInstanceForTesting(&mock_csis_client_module_);
    ON_CALL(mock_csis_client_module_, Get())
    ON_CALL(mock_csis_client_module_, Get())
        .WillByDefault(Return(&mock_csis_client_module_));
        .WillByDefault(Return(&mock_csis_client_module_));
+2 −1
Original line number Original line Diff line number Diff line
@@ -1369,7 +1369,8 @@ class UnicastTestNoInit : public Test {
    available_src_context_types_ = 0xffff;
    available_src_context_types_ = 0xffff;
    supported_snk_context_types_ = 0xffff;
    supported_snk_context_types_ = 0xffff;
    supported_src_context_types_ = 0xffff;
    supported_src_context_types_ = 0xffff;
    le_audio::AudioSetConfigurationProvider::Initialize();
    le_audio::AudioSetConfigurationProvider::Initialize(
        ::le_audio::types::CodecLocation::ADSP);
    ASSERT_FALSE(LeAudioClient::IsLeAudioClientRunning());
    ASSERT_FALSE(LeAudioClient::IsLeAudioClientRunning());
  }
  }


+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ class AudioSetConfigurationProvider {
  AudioSetConfigurationProvider();
  AudioSetConfigurationProvider();
  virtual ~AudioSetConfigurationProvider() = default;
  virtual ~AudioSetConfigurationProvider() = default;
  static AudioSetConfigurationProvider* Get();
  static AudioSetConfigurationProvider* Get();
  static void Initialize();
  static void Initialize(types::CodecLocation location);
  static void DebugDump(int fd);
  static void DebugDump(int fd);
  static void Cleanup();
  static void Cleanup();
  virtual const set_configurations::AudioSetConfigurations* GetConfigurations(
  virtual const set_configurations::AudioSetConfigurations* GetConfigurations(
Loading