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

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

leaudio: Fix for stream reconfiguration

This fix following scenario
1. First earbud bonded and started to stream
2. Stream stopped
3. Second device bonded
4. Stream started with previous context type

Code did not reconfigure the group and let only previously configured
device to stream.

Bug: 287260361
Test: manual
Tag: #feature
Change-Id: I86c357fc373b2299beafd0f8be9b5aef7e6b0c17
parent 45762a9b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2028,6 +2028,17 @@ void LeAudioDeviceGroup::AddToAllowListNotConnectedGroupMembers(int gatt_if) {
  }
}

bool LeAudioDeviceGroup::IsConfiguredForContext(
    types::LeAudioContextType context_type) {
  /* Check if all connected group members are configured */
  if (GetConfigurationContextType() != context_type) {
    return false;
  }

  /* Check if used configuration is same as the active one.*/
  return (stream_conf.conf == GetActiveConfiguration());
}

bool LeAudioDeviceGroup::IsConfigurationSupported(
    LeAudioDevice* leAudioDevice,
    const set_configurations::AudioSetConfiguration* audio_set_conf) {
+1 −0
Original line number Diff line number Diff line
@@ -384,6 +384,7 @@ class LeAudioDeviceGroup {
      const types::BidirectionalPair<std::vector<uint8_t>>& ccid_lists);
  void CreateStreamVectorForOffloader(uint8_t direction);
  void StreamOffloaderUpdated(uint8_t direction);
  bool IsConfiguredForContext(types::LeAudioContextType context_type);

  inline types::AseState GetState(void) const { return current_state_; }
  void SetState(types::AseState state) {
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ class LeAudioGroupStateMachineImpl : public LeAudioGroupStateMachine {

    switch (group->GetState()) {
      case AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED:
        if (group->GetConfigurationContextType() == context_type) {
        if (group->IsConfiguredForContext(context_type)) {
          if (group->Activate(context_type)) {
            SetTargetState(group, AseState::BTA_LE_AUDIO_ASE_STATE_STREAMING);
            if (CigCreate(group)) {