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

Commit db7237b2 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "audio_hal_interface: Refine implementation of A2DP StopRequest" into main

parents 3b158f25 2145924a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public:
    return BluetoothAudioStatus::FAILURE;
  }
  virtual BluetoothAudioStatus SuspendStream() const { return BluetoothAudioStatus::FAILURE; }
  virtual BluetoothAudioStatus StopStream() const { return SuspendStream(); }
  virtual BluetoothAudioStatus SetLatencyMode(bool /*low_latency*/) const {
    return BluetoothAudioStatus::FAILURE;
  }
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ BluetoothAudioStatus A2dpTransport::SuspendRequest() {
void A2dpTransport::StopRequest() {
  log::info("");

  auto status = bluetooth_audio_port_->SuspendStream();
  auto status = bluetooth_audio_port_->StopStream();
  a2dp_pending_cmd_ =
          status == BluetoothAudioStatus::PENDING ? A2DP_CTRL_CMD_STOP : A2DP_CTRL_CMD_NONE;
}
+16 −0
Original line number Diff line number Diff line
@@ -364,6 +364,7 @@ class A2dpAudioPort : public bluetooth::audio::a2dp::BluetoothAudioPort {

    // Check if the stream has already been started.
    if (btif_av_stream_started_ready(A2dpType::kSource)) {
      log::verbose("stream is already started");
      return BluetoothAudioStatus::SUCCESS;
    }

@@ -386,6 +387,7 @@ class A2dpAudioPort : public bluetooth::audio::a2dp::BluetoothAudioPort {
    // Check if the stream is already suspended.
    if (!btif_av_stream_started_ready(A2dpType::kSource)) {
      btif_av_clear_remote_suspend_flag(A2dpType::kSource);
      log::verbose("stream is already suspended");
      return BluetoothAudioStatus::SUCCESS;
    }

@@ -395,6 +397,20 @@ class A2dpAudioPort : public bluetooth::audio::a2dp::BluetoothAudioPort {
    return BluetoothAudioStatus::PENDING;
  }

  BluetoothAudioStatus StopStream() const override {
    // Check if the stream is already suspended.
    if (!btif_av_stream_started_ready(A2dpType::kSource)) {
      btif_av_clear_remote_suspend_flag(A2dpType::kSource);
      log::verbose("stream is already stopped");
      return BluetoothAudioStatus::SUCCESS;
    }

    // Post stop event. The stop request is pending, but completion is not
    // notified to the HAL.
    btif_av_stream_stop(RawAddress::kEmpty);
    return BluetoothAudioStatus::PENDING;
  }

  BluetoothAudioStatus SetLatencyMode(bool low_latency) const override {
    btif_av_set_low_latency(low_latency);
    return BluetoothAudioStatus::SUCCESS;