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

Commit 29b69eef authored by Chen Chen's avatar Chen Chen
Browse files

Spatial Audio: Move setLowLatencyModeAllowed from hidl to aidl

Bug: 214615268
Tag: #feature
Test: build
Change-Id: I655e07ab0f38f672bdd77cbbe4f12b7879510e25
parent 7b7c9282
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ bool set_audio_low_latency_mode_allowed(bool allowed){
    hidl::a2dp::set_low_latency_mode_allowed(allowed);
    return true;
  }
  aidl::a2dp::set_low_latency_mode_allowed(allowed);
  return false;
}

+9 −0
Original line number Diff line number Diff line
@@ -552,6 +552,15 @@ void set_remote_delay(uint16_t delay_report) {
      ->SetRemoteDelay(delay_report);
}

// Set low latency buffer mode allowed or disallowed
void set_low_latency_mode_allowed(bool allowed) {
  if (!is_hal_enabled()) {
    LOG(ERROR) << __func__ << ": BluetoothAudio HAL is not enabled";
    return;
  }
  active_hal_interface->SetLowLatencyModeAllowed(allowed);
}

}  // namespace a2dp
}  // namespace aidl
}  // namespace audio
+4 −0
Original line number Diff line number Diff line
@@ -81,6 +81,10 @@ size_t read(uint8_t* p_buf, uint32_t len);
 ***/
void set_remote_delay(uint16_t delay_report);

/***
 * Set low latency buffer mode allowed or disallowed
 ***/
void set_low_latency_mode_allowed(bool allowed);
}  // namespace a2dp
}  // namespace aidl
}  // namespace audio
+17 −0
Original line number Diff line number Diff line
@@ -232,6 +232,23 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig(
  return true;
}

bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) {
  if (provider_ == nullptr) {
    LOG(INFO) << __func__
              << ": BluetoothAudioHal nullptr";
    return false;
  }

  auto aidl_retval = provider_->setLowLatencyModeAllowed(allowed);
  if (!aidl_retval.isOk()) {
    LOG(ERROR) << __func__ << ": BluetoothAudioHal failure: "
               << aidl_retval.getDescription();
    return false;
  }
  return true;
}


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

  bool UpdateAudioConfig(const AudioConfiguration& audioConfig);

  bool SetLowLatencyModeAllowed(bool allowed);

  void FlushAudioData();

  static constexpr PcmConfiguration kInvalidPcmConfiguration = {};