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

Commit 50fd7d6b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I9b4328e9,Iff2ea989,I8108b84d am: a7966cef

parents a92bf66c a7966cef
Loading
Loading
Loading
Loading
+30 −27
Original line number Diff line number Diff line
@@ -299,24 +299,32 @@ class LeAudioClientImpl : public LeAudioClient {
      return;
    }

    /* Releasement didn't finished in time */
    if (group->GetTargetState() == AseState::BTA_LE_AUDIO_ASE_STATE_IDLE) {
    LOG_ERROR(
        " State not achieved on time for group: group id %d, current state %s, "
        "target state: %s",
        group_id, ToString(group->GetState()).c_str(),
        ToString(group->GetTargetState()).c_str());
    group->SetTargetState(AseState::BTA_LE_AUDIO_ASE_STATE_IDLE);

    /* There is an issue with a setting up stream or any other operation which
     * are gatt operations. It means peer is not responsable. Lets close ACL
     */
    CancelStreamingRequest();
    LeAudioDevice* leAudioDevice = group->GetFirstActiveDevice();
      LOG_ASSERT(leAudioDevice)
          << __func__ << " Shouldn't be called without an active device.";
    if (leAudioDevice == nullptr) {
      LOG_ERROR(" Shouldn't be called without an active device.");
      leAudioDevice = group->GetFirstDevice();
      if (leAudioDevice == nullptr) {
        LOG_ERROR(" Front device is null. Number of devices: %d",
                  group->Size());
        return;
      }
    }

    do {
      if (instance) instance->DisconnectDevice(leAudioDevice, true);
      leAudioDevice = group->GetNextActiveDevice(leAudioDevice);
    } while (leAudioDevice);

      return;
    }

    LOG(ERROR) << __func__ << ", State not achieved on time, releasing ases";

    groupStateMachine_->StopStream(group);
  }

  void UpdateContextAndLocations(LeAudioDeviceGroup* group,
@@ -3216,16 +3224,6 @@ class LeAudioClientImpl : public LeAudioClient {
        rxUnreceivedPackets, duplicatePackets);
  }

  void CompleteUserConfiguration(LeAudioDeviceGroup* group) {
    if (audio_sender_state_ == AudioState::RELEASING) {
      audio_sender_state_ = AudioState::IDLE;
    }

    if (audio_receiver_state_ == AudioState::RELEASING) {
      audio_receiver_state_ = AudioState::IDLE;
    }
  }

  void HandlePendingAvailableContexts(LeAudioDeviceGroup* group) {
    if (!group) return;

@@ -3272,7 +3270,12 @@ class LeAudioClientImpl : public LeAudioClient {
        SuspendAudio();
        break;
      case GroupStreamStatus::CONFIGURED_BY_USER:
        CompleteUserConfiguration(group);
        /* We are done with reconfiguration.
         * Clean state and if Audio HAL is waiting, cancel the request
         * so Audio HAL can Resume again.
         */
        CancelStreamingRequest();
        HandlePendingAvailableContexts(group);
        break;
      case GroupStreamStatus::CONFIGURED_AUTONOMOUS:
        /* This state is notified only when
+6 −0
Original line number Diff line number Diff line
@@ -60,7 +60,13 @@ void LeAudioDeviceGroup::AddNode(

void LeAudioDeviceGroup::RemoveNode(
    const std::shared_ptr<LeAudioDevice>& leAudioDevice) {
  /* Group information cleaning in the device. */
  leAudioDevice->group_id_ = bluetooth::groups::kGroupUnknown;
  for (auto ase : leAudioDevice->ases_) {
    ase.active = false;
    ase.cis_conn_hdl = 0;
  }

  leAudioDevices_.erase(
      std::remove_if(
          leAudioDevices_.begin(), leAudioDevices_.end(),