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

Commit b36bcd2f authored by shihchienc's avatar shihchienc
Browse files

leaudio: Remove duplicate logic

In the beginning of `GetAudioSessionCodecConfigForDirection()`, the
logic is same as GetConfiguration(). Change to use Getconfiguration() to
remove duplicate code.

Bug: 259191520
Flag: Exempt, no functional change. Regression tested with unittests
Test: atest bluetooth_le_audio_test bluetooth_le_audio_client_test
Change-Id: If733d4acf00135f39b2b44013752875e2e3934b4
parent 192e0291
Loading
Loading
Loading
Loading
+1 −14
Original line number Original line Diff line number Diff line
@@ -1642,20 +1642,7 @@ LeAudioDeviceGroup::GetConfiguration(LeAudioContextType context_type) const {


LeAudioCodecConfiguration LeAudioDeviceGroup::GetAudioSessionCodecConfigForDirection(
LeAudioCodecConfiguration LeAudioDeviceGroup::GetAudioSessionCodecConfigForDirection(
        LeAudioContextType context_type, uint8_t direction) const {
        LeAudioContextType context_type, uint8_t direction) const {
  const set_configurations::AudioSetConfiguration* conf = nullptr;
  auto audio_set_conf = GetConfiguration(context_type);
  bool is_valid = false;

  /* Refresh the cache if there is no valid configuration */
  if (context_to_configuration_cache_map.count(context_type) != 0) {
    auto& valid_config_pair = context_to_configuration_cache_map.at(context_type);
    is_valid = valid_config_pair.first;
    conf = valid_config_pair.second.get();
  }
  if (!is_valid || (conf == nullptr)) {
    UpdateAudioSetConfigurationCache(context_type);
  }

  auto audio_set_conf = GetCachedConfiguration(context_type);
  if (!audio_set_conf) {
  if (!audio_set_conf) {
    return {0, 0, 0, 0};
    return {0, 0, 0, 0};
  }
  }