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

Commit 7c48034d authored by Limon Mia's avatar Limon Mia
Browse files

BTAudio HAL: implement changes for DSA Over LEA

Test: atest VtsHalBluetoothAudioTargetTest
Bug: 270987427
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f6a9577ac7585a5c284896736ba3508f7ed7528a)
Merged-In: I341e3af726da7870e23f5bb0943066ebcdd34e35
Change-Id: I341e3af726da7870e23f5bb0943066ebcdd34e35
parent 17017a2a
Loading
Loading
Loading
Loading
+25 −8
Original line number Diff line number Diff line
@@ -588,15 +588,32 @@ std::vector<LatencyMode> BluetoothAudioSession::GetSupportedLatencyModes() {
               << " has NO session";
    return std::vector<LatencyMode>();
  }
  if (low_latency_allowed_) return latency_modes_;
  std::vector<LatencyMode> modes;

  std::vector<LatencyMode> supported_latency_modes;
  if (session_type_ ==
      SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH) {
    for (LatencyMode mode : latency_modes_) {
      if (mode == LatencyMode::LOW_LATENCY) {
        // LOW_LATENCY is not supported for LE_HARDWARE_OFFLOAD_ENC sessions
        continue;
      }
      supported_latency_modes.push_back(mode);
    }
  } else {
    for (LatencyMode mode : latency_modes_) {
    if (mode == LatencyMode::LOW_LATENCY)
      // ignore those low latency mode if Bluetooth stack doesn't allow
      if (!low_latency_allowed_ && mode == LatencyMode::LOW_LATENCY) {
        // ignore LOW_LATENCY mode if Bluetooth stack doesn't allow
        continue;
      }
      if (mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_SOFTWARE ||
          mode == LatencyMode::DYNAMIC_SPATIAL_AUDIO_HARDWARE) {
        // DSA_SW and DSA_HW only supported for LE_HARDWARE_OFFLOAD_ENC sessions
        continue;
    modes.push_back(mode);
      }
  return modes;
      supported_latency_modes.push_back(mode);
    }
  }
  return supported_latency_modes;
}

void BluetoothAudioSession::SetLatencyMode(const LatencyMode& latency_mode) {