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

Commit 3579d56a authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix issue with not moving to Streaming state

When STREAMING state was received before CIS data path is established,
the group was not moving to Streaming state which lead to watchdog
timeout.

Bug: 315222220
Test: atest bluetooth_le_audio_test
Tag: #feature
Change-Id: I1a5e08c34f5913788c8e847fd165765e25275b3a
parent 200035a2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ class LeAudioDeviceGroup {

  /* Current audio stream configuration */
  struct stream_configuration stream_conf;
  bool notify_streaming_when_cises_are_ready_;

  uint8_t audio_directions_;
  types::AudioLocations snk_audio_locations_;
@@ -90,6 +91,7 @@ class LeAudioDeviceGroup {
      : group_id_(group_id),
        cig(this),
        stream_conf({}),
        notify_streaming_when_cises_are_ready_(false),
        audio_directions_(0),
        dsa_mode_(DsaMode::DISABLED),
        is_enabled_(true),
@@ -235,6 +237,12 @@ class LeAudioDeviceGroup {
  }

  inline types::AseState GetTargetState(void) const { return target_state_; }
  inline void SetNotifyStreamingWhenCisesAreReadyFlag(bool value) {
    notify_streaming_when_cises_are_ready_ = value;
  }
  inline bool GetNotifyStreamingWhenCisesAreReadyFlag(void) {
    return notify_streaming_when_cises_are_ready_;
  }
  void SetTargetState(types::AseState state) {
    LOG(INFO) << __func__ << " target state: " << target_state_
              << " new target state: " << state;
+19 −2
Original line number Diff line number Diff line
@@ -618,9 +618,22 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    if (group->GetState() == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING &&
        !group->GetFirstActiveDeviceByCisAndDataPathState(
            CisState::CONNECTED, DataPathState::IDLE)) {
      /* No more transition for group */
      /* No more transition for group. Here we are for the late join device
       * scenario */
      cancel_watchdog_if_needed(group->group_id_);
    }

    if (group->GetNotifyStreamingWhenCisesAreReadyFlag() &&
        group->IsGroupStreamReady()) {
      group->SetNotifyStreamingWhenCisesAreReadyFlag(false);
      LOG_INFO("Ready to notify Group Streaming.");
      cancel_watchdog_if_needed(group->group_id_);
      if (group->GetState() != AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
        group->SetState(AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
      }
      state_machine_callbacks_->StatusReportCb(group->group_id_,
                                               GroupStreamStatus::STREAMING);
    };
  }

  void ProcessHciNotifRemoveIsoDataPath(LeAudioDeviceGroup* group,
@@ -2682,7 +2695,11 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
        }

        /* Not all CISes establish events will came */
        if (!group->IsGroupStreamReady()) return;
        if (!group->IsGroupStreamReady()) {
          LOG_INFO("CISes are not yet ready, wait for it.");
          group->SetNotifyStreamingWhenCisesAreReadyFlag(true);
          return;
        }

        if (group->GetTargetState() ==
            AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {