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

Commit 423b9c3d authored by Jack He's avatar Jack He
Browse files

BT: Broadcast AIDL alignment

* Align Bluetooth code with latest AIDL change
* Rename remote_delay to remote_delay_ms to include the unit

Bug: 15067092
Test: make
Tag: #feature
Change-Id: I8990765f6cbb8d59e4fa6dcef3e070edaec4fdd9
parent ae7b3607
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@
#include <aidl/android/hardware/bluetooth/audio/AudioConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/AudioConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/AudioLocation.h>
#include <aidl/android/hardware/bluetooth/audio/AudioLocation.h>
#include <aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.h>
#include <aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.h>
#include <aidl/android/hardware/bluetooth/audio/BroadcastConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/ChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/ChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/CodecCapabilities.h>
#include <aidl/android/hardware/bluetooth/audio/CodecCapabilities.h>
#include <aidl/android/hardware/bluetooth/audio/CodecConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/CodecConfiguration.h>
@@ -52,10 +51,10 @@
#include <aidl/android/hardware/bluetooth/audio/LdacChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/LdacChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/LdacConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LdacConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LdacQualityIndex.h>
#include <aidl/android/hardware/bluetooth/audio/LdacQualityIndex.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/LeAudioMode.h>
#include <aidl/android/hardware/bluetooth/audio/PcmCapabilities.h>
#include <aidl/android/hardware/bluetooth/audio/PcmCapabilities.h>
#include <aidl/android/hardware/bluetooth/audio/PcmConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/PcmConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/PresentationPosition.h>
#include <aidl/android/hardware/bluetooth/audio/PresentationPosition.h>
@@ -64,8 +63,6 @@
#include <aidl/android/hardware/bluetooth/audio/SbcChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/SbcChannelMode.h>
#include <aidl/android/hardware/bluetooth/audio/SbcConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/SbcConfiguration.h>
#include <aidl/android/hardware/bluetooth/audio/SessionType.h>
#include <aidl/android/hardware/bluetooth/audio/SessionType.h>
#include <aidl/android/hardware/bluetooth/audio/UnicastConfiguration.h>





#ifdef LOG_INFO
#ifdef LOG_INFO
+3 −9
Original line number Original line Diff line number Diff line
@@ -36,9 +36,7 @@ using ::aidl::android::hardware::bluetooth::audio::ChannelMode;
using ::aidl::android::hardware::bluetooth::audio::CodecType;
using ::aidl::android::hardware::bluetooth::audio::CodecType;
using ::aidl::android::hardware::bluetooth::audio::Lc3Configuration;
using ::aidl::android::hardware::bluetooth::audio::Lc3Configuration;
using ::aidl::android::hardware::bluetooth::audio::LeAudioCodecConfiguration;
using ::aidl::android::hardware::bluetooth::audio::LeAudioCodecConfiguration;
using ::aidl::android::hardware::bluetooth::audio::LeAudioMode;
using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration;
using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration;
using ::aidl::android::hardware::bluetooth::audio::UnicastConfiguration;
using ::bluetooth::audio::aidl::AudioConfiguration;
using ::bluetooth::audio::aidl::AudioConfiguration;
using ::bluetooth::audio::aidl::BluetoothAudioCtrlAck;
using ::bluetooth::audio::aidl::BluetoothAudioCtrlAck;
using ::bluetooth::audio::le_audio::LeAudioClientInterface;
using ::bluetooth::audio::le_audio::LeAudioClientInterface;
@@ -472,8 +470,8 @@ AudioConfiguration offload_config_to_hal_audio_config(
      .octetsPerFrame = static_cast<int32_t>(offload_config.octets_per_frame),
      .octetsPerFrame = static_cast<int32_t>(offload_config.octets_per_frame),
      .blocksPerSdu = static_cast<int8_t>(offload_config.blocks_per_sdu),
      .blocksPerSdu = static_cast<int8_t>(offload_config.blocks_per_sdu),
  };
  };
  UnicastConfiguration ucast_config = {
  LeAudioConfiguration ucast_config = {
      .peerDelay = static_cast<int32_t>(offload_config.peer_delay),
      .peerDelayUs = static_cast<int32_t>(offload_config.peer_delay_ms * 1000),
      .leAudioCodecConfig = LeAudioCodecConfiguration(lc3_config)};
      .leAudioCodecConfig = LeAudioCodecConfiguration(lc3_config)};


  for (auto& [handle, location] : offload_config.stream_map) {
  for (auto& [handle, location] : offload_config.stream_map) {
@@ -483,11 +481,7 @@ AudioConfiguration offload_config_to_hal_audio_config(
    });
    });
  }
  }


  LeAudioConfiguration le_audio_config{
  return AudioConfiguration(ucast_config);
      .mode = LeAudioMode::UNICAST,
      .modeConfig = LeAudioConfiguration::LeAudioModeConfig(ucast_config),
  };
  return AudioConfiguration(le_audio_config);
}
}


}  // namespace le_audio
}  // namespace le_audio
+3 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,9 @@ class IBluetoothTransportInstance {
        audio_config_.set<AudioConfiguration::leAudioConfig>(
        audio_config_.set<AudioConfiguration::leAudioConfig>(
            audio_config.get<AudioConfiguration::leAudioConfig>());
            audio_config.get<AudioConfiguration::leAudioConfig>());
        break;
        break;
      case AudioConfiguration::leAudioBroadcastConfig:
        audio_config_.set<AudioConfiguration::leAudioBroadcastConfig>(
            audio_config.get<AudioConfiguration::leAudioBroadcastConfig>());
    }
    }
  }
  }


+1 −1
Original line number Original line Diff line number Diff line
@@ -129,7 +129,7 @@ AudioConfiguration_2_2 offload_config_to_hal_audio_config(
  le_audio_config.mode = LeAudioMode::UNICAST;
  le_audio_config.mode = LeAudioMode::UNICAST;
  le_audio_config.config.unicastConfig() = {
  le_audio_config.config.unicastConfig() = {
      .streamMap = std::move(hal_map),
      .streamMap = std::move(hal_map),
      .peerDelay = offload_config.peer_delay,
      .peerDelay = offload_config.peer_delay_ms,
      .lc3Config = {.pcmBitDepth = le_audio_bits_per_sample2audio_hal(
      .lc3Config = {.pcmBitDepth = le_audio_bits_per_sample2audio_hal(
                        offload_config.bits_per_sample),
                        offload_config.bits_per_sample),
                    .samplingFrequency = le_audio_sample_rate2audio_hal(
                    .samplingFrequency = le_audio_sample_rate2audio_hal(
+8 −8
Original line number Original line Diff line number Diff line
@@ -83,7 +83,7 @@ struct codec_manager_impl {
  CodecLocation GetCodecLocation(void) const { return codec_location_; }
  CodecLocation GetCodecLocation(void) const { return codec_location_; }


  void UpdateActiveSourceAudioConfig(
  void UpdateActiveSourceAudioConfig(
      const le_audio::stream_configuration& stream_conf, uint16_t delay) {
      const le_audio::stream_configuration& stream_conf, uint16_t delay_ms) {
    if (stream_conf.sink_streams.empty()) return;
    if (stream_conf.sink_streams.empty()) return;


    sink_config.stream_map = std::move(stream_conf.sink_streams);
    sink_config.stream_map = std::move(stream_conf.sink_streams);
@@ -96,12 +96,12 @@ struct codec_manager_impl {
    // TODO: set the default value 1 for now, would change it if we need more
    // TODO: set the default value 1 for now, would change it if we need more
    // configuration
    // configuration
    sink_config.blocks_per_sdu = 1;
    sink_config.blocks_per_sdu = 1;
    sink_config.peer_delay = delay;
    sink_config.peer_delay_ms = delay_ms;
    LeAudioClientAudioSource::UpdateAudioConfigToHal(sink_config);
    LeAudioClientAudioSource::UpdateAudioConfigToHal(sink_config);
  }
  }


  void UpdateActiveSinkAudioConfig(
  void UpdateActiveSinkAudioConfig(
      const le_audio::stream_configuration& stream_conf, uint16_t delay) {
      const le_audio::stream_configuration& stream_conf, uint16_t delay_ms) {
    if (stream_conf.source_streams.empty()) return;
    if (stream_conf.source_streams.empty()) return;


    source_config.stream_map = std::move(stream_conf.source_streams);
    source_config.stream_map = std::move(stream_conf.source_streams);
@@ -114,7 +114,7 @@ struct codec_manager_impl {
    // TODO: set the default value 1 for now, would change it if we need more
    // TODO: set the default value 1 for now, would change it if we need more
    // configuration
    // configuration
    source_config.blocks_per_sdu = 1;
    source_config.blocks_per_sdu = 1;
    source_config.peer_delay = delay;
    source_config.peer_delay_ms = delay_ms;
    LeAudioClientAudioSink::UpdateAudioConfigToHal(source_config);
    LeAudioClientAudioSink::UpdateAudioConfigToHal(source_config);
  }
  }


@@ -306,17 +306,17 @@ types::CodecLocation CodecManager::GetCodecLocation(void) const {
}
}


void CodecManager::UpdateActiveSourceAudioConfig(
void CodecManager::UpdateActiveSourceAudioConfig(
    const stream_configuration& stream_conf, uint16_t delay) {
    const stream_configuration& stream_conf, uint16_t delay_ms) {
  if (pimpl_->IsRunning())
  if (pimpl_->IsRunning())
    pimpl_->codec_manager_impl_->UpdateActiveSourceAudioConfig(stream_conf,
    pimpl_->codec_manager_impl_->UpdateActiveSourceAudioConfig(stream_conf,
                                                               delay);
                                                               delay_ms);
}
}


void CodecManager::UpdateActiveSinkAudioConfig(
void CodecManager::UpdateActiveSinkAudioConfig(
    const stream_configuration& stream_conf, uint16_t delay) {
    const stream_configuration& stream_conf, uint16_t delay_ms) {
  if (pimpl_->IsRunning())
  if (pimpl_->IsRunning())
    pimpl_->codec_manager_impl_->UpdateActiveSinkAudioConfig(stream_conf,
    pimpl_->codec_manager_impl_->UpdateActiveSinkAudioConfig(stream_conf,
                                                             delay);
                                                             delay_ms);
}
}


const AudioSetConfigurations* CodecManager::GetOffloadCodecConfig(
const AudioSetConfigurations* CodecManager::GetOffloadCodecConfig(
Loading