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

Commit 93a8bdb5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "use_is_stream_active_api" am: c3a31af1 am: c76fe871 am: d191cb8c

parents d20e6d0e d191cb8c
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -258,6 +258,31 @@ bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) {
  return true;
}

int BluetoothAudioClientInterface::GetAidlInterfaceVersion() {
  int aidl_version = -1;
  if (!is_aidl_available()) {
    return aidl_version;
  }

  auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
      ::ndk::SpAIBinder(AServiceManager_waitForService(
          kDefaultAudioProviderFactoryInterface.c_str())));

  if (provider_factory == nullptr) {
    LOG(ERROR) << __func__ << ", can't get aidl version from unknown factory";
    return aidl_version;
  }

  auto aidl_retval = provider_factory->getInterfaceVersion(&aidl_version);
  if (!aidl_retval.isOk()) {
    LOG(FATAL) << __func__
               << ": BluetoothAudioHal::getInterfaceVersion failure: "
               << aidl_retval.getDescription();
  }

  return aidl_version;
}

int BluetoothAudioClientInterface::StartSession() {
  std::lock_guard<std::mutex> guard(internal_mutex_);
  if (provider_ == nullptr) {
+2 −0
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ class BluetoothAudioClientInterface {

  static bool is_aidl_available();

  static int GetAidlInterfaceVersion();

 protected:
  mutable std::mutex internal_mutex_;
  /***
+6 −1
Original line number Diff line number Diff line
@@ -632,16 +632,21 @@ AudioConfiguration offload_config_to_hal_audio_config(
      .peerDelayUs = static_cast<int32_t>(offload_config.peer_delay_ms * 1000),
      .leAudioCodecConfig = LeAudioCodecConfiguration(lc3_config)};

  for (auto& [handle, location] : offload_config.stream_map) {
  for (auto& [handle, location, state] : offload_config.stream_map) {
    ucast_config.streamMap.push_back({
        .streamHandle = handle,
        .audioChannelAllocation = static_cast<int32_t>(location),
        .isStreamActive = state,
    });
  }

  return AudioConfiguration(ucast_config);
}

int GetAidlInterfaceVersion() {
  return BluetoothAudioSinkClientInterface::GetAidlInterfaceVersion();
}

}  // namespace le_audio
}  // namespace aidl
}  // namespace audio
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ bool is_source_hal_enabled();
bool is_sink_hal_enabled();

std::vector<AudioSetConfiguration> get_offload_capabilities();
int GetAidlInterfaceVersion();

class LeAudioTransport {
 public:
+9 −0
Original line number Diff line number Diff line
@@ -63,6 +63,15 @@ aidl::BluetoothAudioSinkClientInterface* get_aidl_client_interface(
  return aidl::le_audio::LeAudioSinkTransport::interface_unicast_;
}

int GetAidlInterfaceVersion() {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::HIDL) {
    return -1;
  }

  return aidl::le_audio::GetAidlInterfaceVersion();
}

aidl::le_audio::LeAudioSinkTransport* get_aidl_transport_instance(
    bool is_broadcaster) {
  if (is_broadcaster)
Loading