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

Commit aa1b5697 authored by Bao Do's avatar Bao Do Committed by Automerger Merge Worker
Browse files

Merge changes I15075455,I03f322e8 into main am: 1cb6465c

parents efc46983 1cb6465c
Loading
Loading
Loading
Loading
+558 −150

File changed.

Preview size limit exceeded, changes collapsed.

+18 −5
Original line number Diff line number Diff line
@@ -122,8 +122,9 @@ class LeAudioOffloadAudioProvider : public BluetoothAudioProvider {
  bool isCapabilitiesMatchedCodecConfiguration(
      std::vector<CodecSpecificConfigurationLtv>& codec_cfg,
      std::vector<CodecSpecificCapabilitiesLtv> codec_capabilities);
  bool isMatchedAseConfiguration(LeAudioAseConfiguration setting_cfg,
                                 LeAudioAseConfiguration requirement_cfg);
  bool filterMatchedAseConfiguration(
      LeAudioAseConfiguration& setting_cfg,
      const LeAudioAseConfiguration& requirement_cfg);
  bool isMatchedBISConfiguration(
      LeAudioBisConfiguration bis_cfg,
      const IBluetoothAudioProvider::LeAudioDeviceCapabilities& capabilities);
@@ -138,7 +139,8 @@ class LeAudioOffloadAudioProvider : public BluetoothAudioProvider {
          direction_configurations,
      const std::vector<std::optional<AseDirectionRequirement>>& requirements,
      std::optional<std::vector<std::optional<AseDirectionConfiguration>>>&
          valid_direction_configurations);
          valid_direction_configurations,
      bool is_exact);
  std::optional<LeAudioAseConfigurationSetting>
  getCapabilitiesMatchedAseConfigurationSettings(
      IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting,
@@ -148,7 +150,8 @@ class LeAudioOffloadAudioProvider : public BluetoothAudioProvider {
  getRequirementMatchedAseConfigurationSettings(
      IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting,
      const IBluetoothAudioProvider::LeAudioConfigurationRequirement&
          requirement);
          requirement,
      bool is_exact);
  bool isMatchedQosRequirement(LeAudioAseQosConfiguration setting_qos,
                               AseQosDirectionRequirement requirement_qos);
  std::optional<LeAudioBroadcastConfigurationSetting>
@@ -160,10 +163,20 @@ class LeAudioOffloadAudioProvider : public BluetoothAudioProvider {
      uint8_t direction,
      const IBluetoothAudioProvider::LeAudioAseQosConfigurationRequirement&
          qosRequirement,
      std::vector<LeAudioAseConfigurationSetting>& ase_configuration_settings);
      std::vector<LeAudioAseConfigurationSetting>& ase_configuration_settings,
      bool is_exact);
  bool isSubgroupConfigurationMatchedContext(
      AudioContext requirement_context,
      IBluetoothAudioProvider::BroadcastQuality quality,
      LeAudioBroadcastSubgroupConfiguration configuration);
  std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>
  matchWithRequirement(
      std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>&
          matched_ase_configuration_settings,
      const std::vector<
          IBluetoothAudioProvider::LeAudioConfigurationRequirement>&
          in_requirements,
      bool is_exact);
};

class LeAudioOffloadOutputAudioProvider : public LeAudioOffloadAudioProvider {
+1 −0
Original line number Diff line number Diff line
@@ -4177,6 +4177,7 @@ class BluetoothAudioProviderLeAudioBroadcastHardwareAidl
        CodecSpecificCapabilitiesLtv::SupportedSamplingFrequencies();
    sampling_rate.bitmask =
        CodecSpecificCapabilitiesLtv::SupportedSamplingFrequencies::HZ48000 |
        CodecSpecificCapabilitiesLtv::SupportedSamplingFrequencies::HZ24000 |
        CodecSpecificCapabilitiesLtv::SupportedSamplingFrequencies::HZ16000;
    auto frame_duration =
        CodecSpecificCapabilitiesLtv::SupportedFrameDurations();
+53 −6
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ void AudioSetConfigurationProviderJson::
    ase_configuration_settings_.clear();
    configurations_.clear();
    auto loaded = LoadContent(kLeAudioSetConfigs, kLeAudioSetScenarios,
                              CodecLocation::HOST);
                              CodecLocation::ADSP);
    if (!loaded)
      LOG(ERROR) << ": Unable to load le audio set configuration files.";
  } else
@@ -371,7 +371,6 @@ void AudioSetConfigurationProviderJson::populateConfigurationData(
      CodecSpecificConfigurationLtv::CodecFrameBlocksPerSDU();
  frame_sdu_structure.value = codec_frames_blocks_per_sdu;
  ase.codecConfiguration.push_back(frame_sdu_structure);
  // TODO: Channel count
}

void AudioSetConfigurationProviderJson::populateAseConfiguration(
@@ -415,8 +414,53 @@ void AudioSetConfigurationProviderJson::populateAseConfiguration(
}

void AudioSetConfigurationProviderJson::populateAseQosConfiguration(
    LeAudioAseQosConfiguration& qos,
    const le_audio::QosConfiguration* qos_cfg) {
    LeAudioAseQosConfiguration& qos, const le_audio::QosConfiguration* qos_cfg,
    LeAudioAseConfiguration& ase) {
  std::optional<CodecSpecificConfigurationLtv::CodecFrameBlocksPerSDU>
      frameBlock = std::nullopt;
  std::optional<CodecSpecificConfigurationLtv::FrameDuration> frameDuration =
      std::nullopt;
  std::optional<CodecSpecificConfigurationLtv::AudioChannelAllocation>
      allocation = std::nullopt;
  std::optional<CodecSpecificConfigurationLtv::OctetsPerCodecFrame> octet =
      std::nullopt;

  for (auto& cfg_ltv : ase.codecConfiguration) {
    auto tag = cfg_ltv.getTag();
    if (tag == CodecSpecificConfigurationLtv::codecFrameBlocksPerSDU) {
      frameBlock =
          cfg_ltv.get<CodecSpecificConfigurationLtv::codecFrameBlocksPerSDU>();
    } else if (tag == CodecSpecificConfigurationLtv::frameDuration) {
      frameDuration =
          cfg_ltv.get<CodecSpecificConfigurationLtv::frameDuration>();
    } else if (tag == CodecSpecificConfigurationLtv::audioChannelAllocation) {
      allocation =
          cfg_ltv.get<CodecSpecificConfigurationLtv::audioChannelAllocation>();
    } else if (tag == CodecSpecificConfigurationLtv::octetsPerCodecFrame) {
      octet = cfg_ltv.get<CodecSpecificConfigurationLtv::octetsPerCodecFrame>();
    }
  }

  int frameBlockValue = 1;
  if (frameBlock.has_value()) frameBlockValue = frameBlock.value().value;

  // Populate maxSdu
  if (allocation.has_value() && octet.has_value()) {
    auto channel_count = std::bitset<32>(allocation.value().bitmask).count();
    qos.maxSdu = channel_count * octet.value().value * frameBlockValue;
  }
  // Populate sduIntervalUs
  if (frameDuration.has_value()) {
    switch (frameDuration.value()) {
      case CodecSpecificConfigurationLtv::FrameDuration::US7500:
        qos.sduIntervalUs = 7500;
        break;
      case CodecSpecificConfigurationLtv::FrameDuration::US10000:
        qos.sduIntervalUs = 10000;
        break;
    }
    qos.sduIntervalUs *= frameBlockValue;
  }
  qos.maxTransportLatencyMs = qos_cfg->max_transport_latency();
  qos.retransmissionNum = qos_cfg->retransmission_number();
}
@@ -436,7 +480,7 @@ AudioSetConfigurationProviderJson::SetConfigurationFromFlatSubconfig(
  populateAseConfiguration(ase, flat_subconfig, qos_cfg);

  // Translate into LeAudioAseQosConfiguration
  populateAseQosConfiguration(qos, qos_cfg);
  populateAseQosConfiguration(qos, qos_cfg, ase);

  // Translate location to data path id
  switch (location) {
@@ -453,6 +497,8 @@ AudioSetConfigurationProviderJson::SetConfigurationFromFlatSubconfig(
      path.dataPathId = kIsoDataPathPlatformDefault;
      break;
  }
  // Move codecId to iso data path
  path.isoDataPathConfiguration.codecId = ase.codecId.value();

  direction_conf.aseConfiguration = ase;
  direction_conf.qosConfiguration = qos;
@@ -678,7 +724,8 @@ bool AudioSetConfigurationProviderJson::LoadScenariosFromFiles(
  media_context.bitmask =
      (AudioContext::ALERTS | AudioContext::INSTRUCTIONAL |
       AudioContext::NOTIFICATIONS | AudioContext::EMERGENCY_ALARM |
       AudioContext::UNSPECIFIED | AudioContext::MEDIA);
       AudioContext::UNSPECIFIED | AudioContext::MEDIA |
       AudioContext::SOUND_EFFECTS);

  AudioContext conversational_context = AudioContext();
  conversational_context.bitmask =
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ class AudioSetConfigurationProviderJson {

  static void populateAseQosConfiguration(
      LeAudioAseQosConfiguration& qos,
      const le_audio::QosConfiguration* qos_cfg);
      const le_audio::QosConfiguration* qos_cfg, LeAudioAseConfiguration& ase);

  static AseDirectionConfiguration SetConfigurationFromFlatSubconfig(
      const le_audio::AudioSetSubConfiguration* flat_subconfig,