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

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

leaudio: Improve group QoS Configure

With this patch, group state machine will send QoS Configure
command simultaneously to all active devices.

Bug: 265501806
Test: atest bluetooth_le_audio_test
Test: atest BluetoothInstrumentationTests
Tag: #feature

Change-Id: I900e4dc788866ddf6535803af5fc427d46bef46b
parent 6efe37d2
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    group->SetState(AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED);

    if (group->GetTargetState() == AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING) {
      StartConfigQoSForTheGroup(group);
      PrepareAndSendQoSToTheGroup(group);
    } else {
      LOG_ERROR(", invalid state transition, from: %s , to: %s",
                ToString(group->GetState()).c_str(),
@@ -1538,7 +1538,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
    }
  }

  void StartConfigQoSForTheGroup(LeAudioDeviceGroup* group) {
  void PrepareAndSendQoSToTheGroup(LeAudioDeviceGroup* group) {
    LeAudioDevice* leAudioDevice = group->GetFirstActiveDevice();
    if (!leAudioDevice) {
      LOG(ERROR) << __func__ << ", no active devices in group";
@@ -1546,8 +1546,11 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
      return;
    }

    for (; leAudioDevice;
         leAudioDevice = group->GetNextActiveDevice(leAudioDevice)) {
      PrepareAndSendConfigQos(group, leAudioDevice);
    }
  }

  void PrepareAndSendCodecConfigure(LeAudioDeviceGroup* group,
                                    LeAudioDevice* leAudioDevice) {
@@ -1913,18 +1916,13 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {
          return;
        }

        LeAudioDevice* leAudioDeviceNext =
            group->GetNextActiveDevice(leAudioDevice);
        if (!group->HaveAllActiveDevicesAsesTheSameState(
                AseState::BTA_LE_AUDIO_ASE_STATE_QOS_CONFIGURED)) {
          LOG_DEBUG("Waiting for all the devices to be in QoS state");
          return;
        }

        /* Configure ASEs qos for next device in group */
        if (leAudioDeviceNext) {
          PrepareAndSendConfigQos(group, leAudioDeviceNext);
        } else {
          leAudioDevice = group->GetFirstActiveDevice();
          LOG_ASSERT(leAudioDevice)
              << __func__ << " Shouldn't be called without an active device.";
        PrepareAndSendEnableToTheGroup(group);
        }

        break;
      }