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

Commit 073bddb6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "LeAudio: Notify Hal after reconfiguration" am: adf5ea84

parents 77645210 adf5ea84
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -347,6 +347,18 @@ void LeAudioClientInterface::Sink::SuspendedForReconfiguration() {
      ->StreamSuspended(aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION);
}

void LeAudioClientInterface::Sink::ReconfigurationComplete() {
  // This is needed only for AIDL since SuspendedForReconfiguration()
  // already calls StreamSuspended(SUCCESS_FINISHED) for HIDL
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::AIDL) {
    // FIXME: For now we have to workaround the missing API and use
    //        StreamSuspended() with SUCCESS_FINISHED ack code.
    get_aidl_client_interface(is_broadcaster_)
        ->StreamSuspended(aidl::BluetoothAudioCtrlAck::SUCCESS_FINISHED);
  }
}

size_t LeAudioClientInterface::Sink::Read(uint8_t* p_buf, uint32_t len) {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::HIDL) {
@@ -456,6 +468,18 @@ void LeAudioClientInterface::Source::SuspendedForReconfiguration() {
      aidl::BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION);
}

void LeAudioClientInterface::Source::ReconfigurationComplete() {
  // This is needed only for AIDL since SuspendedForReconfiguration()
  // already calls StreamSuspended(SUCCESS_FINISHED) for HIDL
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::AIDL) {
    // FIXME: For now we have to workaround the missing API and use
    //        StreamSuspended() with SUCCESS_FINISHED ack code.
    aidl::le_audio::LeAudioSourceTransport::interface->StreamSuspended(
        aidl::BluetoothAudioCtrlAck::SUCCESS_FINISHED);
  }
}

void LeAudioClientInterface::Source::ConfirmStreamingRequest() {
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::HIDL) {
+3 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ class LeAudioClientInterface {
    virtual void UpdateAudioConfigToHal(
        const ::le_audio::offload_config& config) = 0;
    virtual void SuspendedForReconfiguration() = 0;
    virtual void ReconfigurationComplete() = 0;
  };

 public:
@@ -103,6 +104,7 @@ class LeAudioClientInterface {
    void UpdateBroadcastAudioConfigToHal(
        const ::le_audio::broadcast_offload_config& config);
    void SuspendedForReconfiguration() override;
    void ReconfigurationComplete() override;
    // Read the stream of bytes sinked to us by the upper layers
    size_t Read(uint8_t* p_buf, uint32_t len);
    bool IsBroadcaster() { return is_broadcaster_; }
@@ -124,6 +126,7 @@ class LeAudioClientInterface {
    void UpdateAudioConfigToHal(
        const ::le_audio::offload_config& config) override;
    void SuspendedForReconfiguration() override;
    void ReconfigurationComplete() override;
    // Source the given stream of bytes to be sinked into the upper layers
    size_t Write(const uint8_t* p_buf, uint32_t len);
  };
+23 −2
Original line number Diff line number Diff line
@@ -405,6 +405,15 @@ class LeAudioClientImpl : public LeAudioClient {
    }
  }

  static void ReconfigurationComplete(uint8_t directions) {
    if (directions & le_audio::types::kLeAudioDirectionSink) {
      leAudioClientAudioSource->ReconfigurationComplete();
    }
    if (directions & le_audio::types::kLeAudioDirectionSource) {
      leAudioClientAudioSink->ReconfigurationComplete();
    }
  }

  void CancelStreamingRequest() {
    if (audio_sender_state_ >= AudioState::READY_TO_START) {
      leAudioClientAudioSource->CancelStreamingRequest();
@@ -3548,14 +3557,26 @@ class LeAudioClientImpl : public LeAudioClient {
        /** Stop Audio but don't release all the Audio resources */
        SuspendAudio();
        break;
      case GroupStreamStatus::CONFIGURED_BY_USER:
      case GroupStreamStatus::CONFIGURED_BY_USER: {
        // Check which directions were suspended
        uint8_t previously_active_directions = 0;
        if (audio_sender_state_ >= AudioState::READY_TO_START) {
          previously_active_directions |=
              le_audio::types::kLeAudioDirectionSink;
        }
        if (audio_receiver_state_ >= AudioState::READY_TO_START) {
          previously_active_directions |=
              le_audio::types::kLeAudioDirectionSource;
        }

        /* We are done with reconfiguration.
         * Clean state and if Audio HAL is waiting, cancel the request
         * so Audio HAL can Resume again.
         */
        CancelStreamingRequest();
        HandlePendingAvailableContexts(group);
        break;
        ReconfigurationComplete(previously_active_directions);
      } break;
      case GroupStreamStatus::CONFIGURED_AUTONOMOUS:
        /* This state is notified only when
         * groups stays into CONFIGURED state after
+22 −0
Original line number Diff line number Diff line
@@ -449,6 +449,17 @@ void LeAudioClientAudioSource::SuspendedForReconfiguration() {
  sinkClientInterface_->SuspendedForReconfiguration();
}

void LeAudioClientAudioSource::ReconfigurationComplete() {
  LOG(INFO) << __func__;
  if ((sinkClientInterface_ == nullptr) ||
      (le_audio_sink_hal_state != HAL_STARTED)) {
    LOG(ERROR) << "LE audio device HAL was not started!";
    return;
  }

  sinkClientInterface_->ReconfigurationComplete();
}

void LeAudioClientAudioSource::CancelStreamingRequest() {
  LOG(INFO) << __func__;
  if ((sinkClientInterface_ == nullptr) ||
@@ -703,3 +714,14 @@ void LeAudioUnicastClientAudioSink::SuspendedForReconfiguration() {

  sourceClientInterface_->SuspendedForReconfiguration();
}

void LeAudioUnicastClientAudioSink::ReconfigurationComplete() {
  LOG(INFO) << __func__;
  if ((sourceClientInterface_ == nullptr) ||
      (le_audio_source_hal_state != HAL_STARTED)) {
    LOG(ERROR) << "LE audio device HAL was not started!";
    return;
  }

  sourceClientInterface_->ReconfigurationComplete();
}
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ class LeAudioClientAudioSource {
  virtual void UpdateBroadcastAudioConfigToHal(
      const ::le_audio::broadcast_offload_config& config);
  virtual void SuspendedForReconfiguration();
  virtual void ReconfigurationComplete();

  static void DebugDump(int fd);

@@ -170,6 +171,7 @@ class LeAudioUnicastClientAudioSink {
  virtual void UpdateRemoteDelay(uint16_t remote_delay_ms);
  virtual void UpdateAudioConfigToHal(const ::le_audio::offload_config& config);
  virtual void SuspendedForReconfiguration();
  virtual void ReconfigurationComplete();

  static void DebugDump(int fd);

Loading