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

Commit 542bd1db authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Latency mode "FREE" should always be allowed

Test: Start LE audio broadcast
Test: mmm packages/modules/Bluetooth
Bug: 314696536
Bug: 309665975

Change-Id: I2d5731f3b877819c3b29eefbdf63f9ecc683ce66
parent d4550494
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -351,11 +351,16 @@ bool BluetoothAudioClientInterface::SetAllowedLatencyModes(
    return false;
  }

  if (latency_modes.empty()) {
    latency_modes_.clear();
    latency_modes_.push_back(LatencyMode::FREE);
  } else {
    /* Ensure that FREE is always included and remove duplicates if any */
    std::set<LatencyMode> temp_set(latency_modes.begin(), latency_modes.end());
    temp_set.insert(LatencyMode::FREE);
    latency_modes_.clear();
    latency_modes_.assign(temp_set.begin(), temp_set.end());
  }

  for (auto latency_mode : latency_modes) {
    LOG(INFO) << "Latency mode allowed: "
@@ -364,7 +369,7 @@ bool BluetoothAudioClientInterface::SetAllowedLatencyModes(
  }

  /* Low latency mode is used if modes other than FREE are present */
  bool allowed = (latency_modes_.size() > 1);
  bool allowed = !(latency_modes_.empty());
  auto aidl_retval = provider_->setLowLatencyModeAllowed(allowed);
  if (!aidl_retval.isOk()) {
    LOG(WARNING) << __func__ << ": BluetoothAudioHal is not ready: "
+2 −2
Original line number Diff line number Diff line
@@ -870,11 +870,11 @@ bool LeAudioClientInterface::ReleaseSource(
void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::AIDL) {
    std::vector<LatencyMode> latency_modes;
    std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
    for (auto dsa_mode : dsa_modes) {
      switch (dsa_mode) {
        case DsaMode::DISABLED:
          latency_modes.push_back(LatencyMode::FREE);
        // Already added
          break;
        case DsaMode::ACL:
          latency_modes.push_back(LatencyMode::LOW_LATENCY);