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

Commit f234e3cb authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix removing iso data path

Fix incorrect directions set in the
LE Remove Isochronous Data Path command

Bug: 222674521
Bug: 150670922
Test: atest --host bluetooth_le_audio_test bluetooth_le_audio_client_test
Change-Id: I74548185c98e50ce7d2eb10852d5db053d18f13b
parent 6df5147a
Loading
Loading
Loading
Loading
+16 −31
Original line number Diff line number Diff line
@@ -709,6 +709,19 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    }
  }

  static void RemoveDataPathByCisHandle(LeAudioDevice* leAudioDevice,
                                        uint16_t cis_conn_hdl) {
    auto ases_pair = leAudioDevice->GetAsesByCisConnHdl(cis_conn_hdl);
    IsoManager::GetInstance()->RemoveIsoDataPath(
        cis_conn_hdl,
        (ases_pair.sink
             ? bluetooth::hci::iso_manager::kRemoveIsoDataPathDirectionInput
             : 0x00) |
            (ases_pair.source ? bluetooth::hci::iso_manager::
                                    kRemoveIsoDataPathDirectionOutput
                              : 0x00));
  }

  void ProcessHciNotifCisDisconnected(
      LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice,
      const bluetooth::hci::iso_manager::cis_disconnected_evt* event) override {
@@ -825,18 +838,9 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    }

    LOG_ASSERT(ase) << __func__ << " shouldn't be called without an active ASE";
    ases_pair = leAudioDevice->GetAsesByCisConnHdl(ase->cis_conn_hdl);

    if (ase->data_path_state ==
        AudioStreamDataPathState::DATA_PATH_ESTABLISHED) {
      IsoManager::GetInstance()->RemoveIsoDataPath(
          ase->cis_conn_hdl,
          (ases_pair.sink
               ? bluetooth::hci::iso_manager::kRemoveIsoDataPathDirectionOutput
               : 0x00) |
              (ases_pair.source ? bluetooth::hci::iso_manager::
                                      kRemoveIsoDataPathDirectionInput
                                : 0x00));
      RemoveDataPathByCisHandle(leAudioDevice, ase->cis_conn_hdl);
    }
  }

@@ -1065,17 +1069,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
        AudioStreamDataPathState::DATA_PATH_ESTABLISHED);
    LOG_ASSERT(ase) << __func__
                    << " Shouldn't be called without an active ASE.";

    auto ases_pair = leAudioDevice->GetAsesByCisConnHdl(ase->cis_conn_hdl);

    IsoManager::GetInstance()->RemoveIsoDataPath(
        ase->cis_conn_hdl,
        (ases_pair.sink
             ? bluetooth::hci::iso_manager::kRemoveIsoDataPathDirectionOutput
             : 0x00) |
            (ases_pair.source
                 ? bluetooth::hci::iso_manager::kRemoveIsoDataPathDirectionInput
                 : 0x00));
    RemoveDataPathByCisHandle(leAudioDevice, ase->cis_conn_hdl);
  }

  void AseStateMachineProcessIdle(
@@ -1899,16 +1893,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

        if (ase->data_path_state ==
            AudioStreamDataPathState::DATA_PATH_ESTABLISHED) {
          auto ases_pair =
              leAudioDevice->GetAsesByCisConnHdl(ase->cis_conn_hdl);
          IsoManager::GetInstance()->RemoveIsoDataPath(
              ase->cis_conn_hdl,
              (ases_pair.sink ? bluetooth::hci::iso_manager::
                                    kRemoveIsoDataPathDirectionOutput
                              : 0x00) |
                  (ases_pair.source ? bluetooth::hci::iso_manager::
                                          kRemoveIsoDataPathDirectionInput
                                    : 0x00));
          RemoveDataPathByCisHandle(leAudioDevice, ase->cis_conn_hdl);
        } else if (ase->data_path_state ==
                       AudioStreamDataPathState::CIS_ESTABLISHED ||
                   ase->data_path_state ==