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

Commit b49ffb32 authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge "leaudio: Fix assigning bidirectional CIS to ASE for TWS headset."

parents f7ec69cb c8f00a00
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1039,7 +1039,7 @@ bool LeAudioDeviceGroup::CigAssignCisIds(LeAudioDevice* leAudioDevice) {
      LOG_INFO("ASE ID: %d, is already assigned CIS ID: %d, type %d", ase->id,
               ase->cis_id, cises_[ase->cis_id].type);
      if (!cises_[ase->cis_id].addr.IsEmpty()) {
        LOG_INFO("Bidirectional ASE already assigned");
        LOG_INFO("Bi-Directional CIS already assigned");
        continue;
      }
      /* Reuse existing CIS ID if available*/
@@ -1050,6 +1050,18 @@ bool LeAudioDeviceGroup::CigAssignCisIds(LeAudioDevice* leAudioDevice) {
    struct ase* matching_bidir_ase =
        leAudioDevice->GetNextActiveAseWithDifferentDirection(ase);

    for (; matching_bidir_ase != nullptr;
         matching_bidir_ase = leAudioDevice->GetNextActiveAseWithSameDirection(
             matching_bidir_ase)) {
      if ((matching_bidir_ase->cis_id != kInvalidCisId) &&
          (matching_bidir_ase->cis_id != cis_id)) {
        LOG_INFO("Bi-Directional CIS is already used. ASE Id: %d cis_id=%d",
                 matching_bidir_ase->id, matching_bidir_ase->cis_id);
        continue;
      }
      break;
    }

    if (matching_bidir_ase) {
      if (cis_id == kInvalidCisId) {
        cis_id = GetFirstFreeCisId(CisType::CIS_TYPE_BIDIRECTIONAL);