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

Commit 980bbd46 authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Set the latency modes for sink, not the source

Test: mmm packages/modules/Bluetooth
Test: Manual | connect with LE Audio device supporting DSA
Bug: 314844884
Bug: 309665975
Change-Id: I3801dd03afbf6341bf5e0038f416183dbfdcf014
parent 2dd3e5c3
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -19,6 +19,8 @@


#include "le_audio_software.h"
#include "le_audio_software.h"


#include <android_bluetooth_flags.h>

#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>


@@ -868,8 +870,18 @@ bool LeAudioClientInterface::ReleaseSource(
}
}


void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) {
void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) {
  if (!IS_FLAG_ENABLED(leaudio_dynamic_spatial_audio)) {
    return;
  }

  if (HalVersionManager::GetHalTransport() ==
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::AIDL) {
      BluetoothAudioHalTransport::AIDL) {
    if (aidl::le_audio::LeAudioSinkTransport::interface_unicast_ == nullptr ||
        aidl::le_audio::LeAudioSinkTransport::instance_unicast_ == nullptr) {
      LOG(WARNING) << __func__ << ": LeAudioSourceTransport::interface is null";
      return;
    }

    std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
    std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
    for (auto dsa_mode : dsa_modes) {
    for (auto dsa_mode : dsa_modes) {
      switch (dsa_mode) {
      switch (dsa_mode) {
@@ -890,12 +902,8 @@ void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) {
          break;
          break;
      }
      }
    }
    }
    if (aidl::le_audio::LeAudioSourceTransport::interface) {
    aidl::le_audio::LeAudioSinkTransport::interface_unicast_
      aidl::le_audio::LeAudioSourceTransport::interface->SetAllowedLatencyModes(
        ->SetAllowedLatencyModes(latency_modes);
          latency_modes);
    } else {
      LOG(WARNING) << "LeAudioSourceTransport::interface is null";
    }
  }
  }
}
}