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

Commit 98c0a31e authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

a2dp: stop instead of disconnecting on offload fail

Instead of disconnecting AVDTP when offload fails trigger stop stream.
The offload may be failing due to ongoing SCO.

Bug: 340245529
Bug: 345709100
Flag: com.android.bluetooth.flags.stop_on_offload_fail
Test: mmm packages/modules/Bluetooth
Change-Id: I10bde20ee93efad30a472c99912262f22cb85634
parent 8493b818
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -166,13 +166,17 @@ void btif_a2dp_on_offload_started(const RawAddress& peer_addr, tBTA_AV_STATUS st

  if (btif_av_is_a2dp_offload_running()) {
    if (ack != BluetoothAudioStatus::SUCCESS && btif_av_stream_started_ready(A2dpType::kSource)) {
      log::error("peer {} offload start failed", peer_addr);
      if (com::android::bluetooth::flags::stop_on_offload_fail()) {
        btif_av_stream_stop(peer_addr);
      } else {
        // Offload request will return with failure from btif_av sm if
        // suspend is triggered for remote start. Disconnect only if SoC
        // returned failure for offload VSC
      log::error("peer {} offload start failed", peer_addr);
        btif_av_source_disconnect(peer_addr);
      }
    }
  }

  bluetooth::audio::a2dp::ack_stream_started(ack);
}