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

Commit 63f52f43 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix removing data path

So far when CIS was disconnected with different reason than
HCI_ERR_CONN_CAUSE_LOCAL_HOST, then datapath was removed.

State Machine was not doing that when reason
HCI_ERR_CONN_CAUSE_LOCAL_HOST because when disconenction is intiated by
LeAudio, then datapath is already removed.

However it might happen that ACL can be disconnected by other module of
Bluetooth stack e.g. timeout on GATT transaction. In such a case,
controller will notify Host about CIS disconnection and ACL
disconnection with the reason HCI_ERR_CONN_CAUSE_LOCAL_HOST.

In this case, LeAudio shall clear data path.

Bug: 308095683
Test: atest bluetooth_le_audio_test
Tag: #feature
Change-Id: If698a2a05bd7ebdd0ea8ceae23fe0e4efe461317
parent 01ef9e2c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -965,9 +965,10 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
      ases_pair.source->cis_state = CisState::ASSIGNED;
    }

    RemoveDataPathByCisHandle(leAudioDevice, event->cis_conn_hdl);

    /* If this is peer disconnecting CIS, make sure to clear data path */
    if (event->reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) {
      RemoveDataPathByCisHandle(leAudioDevice, event->cis_conn_hdl);
      // Make sure we won't stay in STREAMING state
      if (ases_pair.sink &&
          ases_pair.sink->state == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
+1 −1
Original line number Diff line number Diff line
@@ -5516,7 +5516,7 @@ TEST_F(StateMachineTest, StreamReconfigureAfterCisLostTwoDevices) {
  EXPECT_CALL(*mock_iso_manager_, CreateCig(_, _)).Times(2);
  EXPECT_CALL(*mock_iso_manager_, EstablishCis(_)).Times(2);
  EXPECT_CALL(*mock_iso_manager_, SetupIsoDataPath(_, _)).Times(6);
  EXPECT_CALL(*mock_iso_manager_, RemoveIsoDataPath(_, _)).Times(0);
  EXPECT_CALL(*mock_iso_manager_, RemoveIsoDataPath(_, _)).Times(2);
  EXPECT_CALL(*mock_iso_manager_, DisconnectCis(_, _)).Times(0);
  EXPECT_CALL(*mock_iso_manager_, RemoveCig(_, _)).Times(1);