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

Commit 3ac3486a authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge changes I3921e6e3,I6224e649 into main

* changes:
  LeAudio/Broadcaster: Improve audio location selection
  LeAudio/CodecExtensibility: Use proper data path
parents b885f577 782153a8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -523,6 +523,15 @@ GetStackDataPathFromAidlFormat(
    config.dataPathConfig = *dp.dataPathConfiguration.configuration;
  }

  // Due to AIDL not having the Transparent codec type, it uses the boolean and
  // we should manually align the codecId.
  if (config.isoDataPathConfig.isTransparent) {
    config.isoDataPathConfig.codecId.coding_format =
        bluetooth::hci::kIsoCodingFormatTransparent;
    config.isoDataPathConfig.codecId.vendor_codec_id = 0x00;
    config.isoDataPathConfig.codecId.vendor_company_id = 0x00;
  }

  if (dp.isoDataPathConfiguration.configuration) {
    config.isoDataPathConfig.configuration =
        *dp.isoDataPathConfiguration.configuration;
+14 −2
Original line number Diff line number Diff line
@@ -73,6 +73,14 @@ static const ::bluetooth::le_audio::types::LeAudioCodecId kStackCodecVendor1 = {
aidl::android::hardware::bluetooth::audio::CodecId::Vendor kAidlCodecVendor1{
    .id = 0xC0DE, .codecId = 0xF00D};

static const ::bluetooth::le_audio::types::LeAudioCodecId
    kStackCodecTransparent = {
        .coding_format = ::bluetooth::hci::kIsoCodingFormatTransparent,
        .vendor_company_id =
            ::bluetooth::le_audio::types::kLeAudioVendorCompanyIdUndefined,
        .vendor_codec_id =
            ::bluetooth::le_audio::types::kLeAudioVendorCodecIdUndefined};

namespace test_utils {

static auto PrepareStackMetadataLtv() {
@@ -208,7 +216,9 @@ PrepareReferenceLeAudioDataPathConfigurationVendor() {
  ::bluetooth::le_audio::types::DataPathConfiguration stack_config;
  stack_config.dataPathId = config.dataPathId;
  stack_config.dataPathConfig = *config.dataPathConfiguration.configuration;
  stack_config.isoDataPathConfig.codecId = kStackCodecVendor1;
  stack_config.isoDataPathConfig.codecId =
      config.isoDataPathConfiguration.isTransparent ? kStackCodecTransparent
                                                    : kStackCodecVendor1;
  stack_config.isoDataPathConfig.isTransparent =
      config.isoDataPathConfiguration.isTransparent;
  stack_config.isoDataPathConfig.controllerDelayUs =
@@ -243,7 +253,9 @@ PrepareReferenceLeAudioDataPathConfigurationLc3() {
  ::bluetooth::le_audio::types::DataPathConfiguration stack_config;
  stack_config.dataPathId = config.dataPathId;
  stack_config.dataPathConfig = *config.dataPathConfiguration.configuration;
  stack_config.isoDataPathConfig.codecId = kStackCodecLc3;
  stack_config.isoDataPathConfig.codecId =
      config.isoDataPathConfiguration.isTransparent ? kStackCodecTransparent
                                                    : kStackCodecLc3;
  stack_config.isoDataPathConfig.isTransparent =
      config.isoDataPathConfiguration.isTransparent;
  stack_config.isoDataPathConfig.controllerDelayUs =
+2 −1
Original line number Diff line number Diff line
@@ -232,7 +232,8 @@ class LeAudioBroadcasterImpl : public LeAudioBroadcaster, public BigCallbacks {
          }

          // Check for non vendor LTVs
          auto config_ltv = subgroup_config.GetBisCodecSpecData(bis_num);
          auto config_ltv =
              subgroup_config.GetBisCodecSpecData(bis_num, bis_cfg_idx);
          if (config_ltv) {
            // Remove the part which is common with the parent subgroup
            // parameters
+1 −1
Original line number Diff line number Diff line
@@ -751,7 +751,7 @@ static BasicAudioAnnouncementData prepareAnnouncement(
      }

      // Check for non vendor LTVs
      auto config_ltv = codec_config.GetBisCodecSpecData(bis_num);
      auto config_ltv = codec_config.GetBisCodecSpecData(bis_num, cfg_idx);
      if (config_ltv) {
        bis_config.codec_specific_params = config_ltv->Values();
      }
+6 −4
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ struct BroadcastSubgroupCodecConfig {

    // Currently not a single software vendor codec was integrated and only the
    // LTVs parameters are understood by the BT stack.
    auto opt_ltvs = GetBisCodecSpecData(bis_idx);
    auto opt_ltvs = GetBisCodecSpecData(bis_idx, 0);
    if (opt_ltvs) {
      return opt_ltvs->GetAsCoreCodecConfig().octets_per_codec_frame.value_or(
                 0) *
@@ -202,9 +202,11 @@ struct BroadcastSubgroupCodecConfig {
  }

  std::optional<types::LeAudioLtvMap> GetBisCodecSpecData(
      uint8_t bis_idx) const {
      uint8_t bis_idx, uint8_t bis_config_idx) const {
    if (bis_codec_configs_.empty()) return std::nullopt;
    auto config = bis_codec_configs_.at(0);
    log::assert_that(bis_config_idx < bis_codec_configs_.size(),
                     "Invalid bis config index");
    auto config = bis_codec_configs_.at(bis_config_idx);
    if ((bis_idx != 0) && (bis_idx < bis_codec_configs_.size())) {
      config = bis_codec_configs_.at(bis_idx);
    }
@@ -216,7 +218,7 @@ struct BroadcastSubgroupCodecConfig {
    auto cfg = config.GetCodecSpecData();
    /* Set the audio locations if not set */
    if (!cfg.Find(codec_spec_conf::kLeAudioLtvTypeAudioChannelAllocation)) {
      switch (bis_idx) {
      switch (bis_config_idx + bis_idx) {
        case 0:
          cfg.Add(codec_spec_conf::kLeAudioLtvTypeAudioChannelAllocation,
                  codec_spec_conf::kLeAudioLocationFrontLeft);
Loading