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

Commit cfc4d811 authored by Chen Chen's avatar Chen Chen Committed by Automerger Merge Worker
Browse files

Merge "SpatialAudio: Set low latency allowed signal at startSession The logic...

Merge "SpatialAudio: Set low latency allowed signal at startSession The logic is that to send FREE and LOW_LATENCY to audio at startSession, if bt receives setLowLatencyModeAllowed(true) before start session. If the parameter false, or bt doesn't receive the signal at all, then bt sends FREE to audio." am: ad135885

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1984908

Change-Id: I760e3341c74176fe491464768d4d3c8e33ea8b87
parents 0499861a ad135885
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -138,14 +138,13 @@ void set_remote_delay(uint16_t delay_report) {
}

// Set low latency buffer mode allowed or disallowed
bool set_audio_low_latency_mode_allowed(bool allowed){
void set_audio_low_latency_mode_allowed(bool allowed) {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::HIDL) {
    hidl::a2dp::set_low_latency_mode_allowed(allowed);
    return true;
    return;
  }
  aidl::a2dp::set_low_latency_mode_allowed(allowed);
  return false;
}

}  // namespace a2dp
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ void cleanup();
bool setup_codec();

// Set low latency buffer mode allowed or disallowed
bool set_audio_low_latency_mode_allowed(bool allowed);
void set_audio_low_latency_mode_allowed(bool allowed);

// Send command to the BluetoothAudio HAL: StartSession, EndSession,
// StreamStarted, StreamSuspended
+1 −2
Original line number Diff line number Diff line
@@ -244,8 +244,7 @@ void end_session() {
  remote_delay_report_ = 0;
}

bool set_audio_low_latency_mode_allowed(bool allowed){
  return true;
void set_audio_low_latency_mode_allowed(bool allowed){
}


+3 −0
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ uint16_t remote_delay = 0;

bool btaudio_a2dp_disabled = false;
bool is_configured = false;
bool is_low_latency_mode_allowed = false;

BluetoothAudioCtrlAck a2dp_ack_to_bt_audio_ctrl_ack(tA2DP_CTRL_ACK ack) {
  switch (ack) {
@@ -470,6 +471,7 @@ void start_session() {
    LOG(ERROR) << __func__ << ": BluetoothAudio HAL is not enabled";
    return;
  }
  active_hal_interface->SetLowLatencyModeAllowed(is_low_latency_mode_allowed);
  active_hal_interface->StartSession();
}

@@ -554,6 +556,7 @@ void set_remote_delay(uint16_t delay_report) {

// Set low latency buffer mode allowed or disallowed
void set_low_latency_mode_allowed(bool allowed) {
  is_low_latency_mode_allowed = allowed;
  if (!is_hal_enabled()) {
    LOG(ERROR) << __func__ << ": BluetoothAudio HAL is not enabled";
    return;
+6 −2
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ bool BluetoothAudioClientInterface::UpdateAudioConfig(
}

bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) {
  is_low_latency_allowed_ = allowed;
  if (provider_ == nullptr) {
    LOG(INFO) << __func__
              << ": BluetoothAudioHal nullptr";
@@ -266,9 +267,12 @@ int BluetoothAudioClientInterface::StartSession() {

  std::unique_ptr<DataMQ> data_mq;
  DataMQDesc mq_desc;

  std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
  if (is_low_latency_allowed_) {
    latency_modes.push_back(LatencyMode::LOW_LATENCY);
  }
  auto aidl_retval = provider_->startSession(
      stack_if, transport_->GetAudioConfiguration(), &mq_desc);
      stack_if, transport_->GetAudioConfiguration(), latency_modes, &mq_desc);
  if (!aidl_retval.isOk()) {
    LOG(FATAL) << __func__ << ": BluetoothAudioHal failure: "
               << aidl_retval.getDescription();
Loading