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

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

leaudio: Update confiuration, when device connected

With this patch, we make sure, device is taken to the audio
configuration, when it is connected on the service level.
Othwerwise, we could end up with not being able to create stream,
because configuration already includes the device which is not ready.
Usually can happen with late device connect.

Bug: 262309077
Test: atest BluetoothInstrumentationTest
Test: manual streaming with late connect
Tag: #feature
Merged-In: I0698a429b7ca6060e6fba57dbe59207ca658abde
Change-Id: I0698a429b7ca6060e6fba57dbe59207ca658abde
(cherry picked from commit d01159bb)
parent f66923d9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -483,6 +483,12 @@ class LeAudioClientImpl : public LeAudioClient {

  void UpdateContextAndLocations(LeAudioDeviceGroup* group,
                                 LeAudioDevice* leAudioDevice) {
    if (leAudioDevice->GetConnectionState() != DeviceConnectState::CONNECTED) {
      LOG_DEBUG("%s not yet connected ",
                leAudioDevice->address_.ToString().c_str());
      return;
    }

    /* Make sure location and direction are updated for the group. */
    auto location_update = group->ReloadAudioLocations();
    group->ReloadAudioDirections();
+6 −2
Original line number Diff line number Diff line
@@ -826,7 +826,9 @@ bool LeAudioDeviceGroup::ReloadAudioLocations(void) {
      codec_spec_conf::kLeAudioLocationNotAllowed;

  for (const auto& device : leAudioDevices_) {
    if (device.expired()) continue;
    if (device.expired() || (device.lock().get()->GetConnectionState() !=
                             DeviceConnectState::CONNECTED))
      continue;
    updated_snk_audio_locations_ |= device.lock().get()->snk_audio_locations_;
    updated_src_audio_locations_ |= device.lock().get()->src_audio_locations_;
  }
@@ -846,7 +848,9 @@ bool LeAudioDeviceGroup::ReloadAudioDirections(void) {
  uint8_t updated_audio_directions = 0x00;

  for (const auto& device : leAudioDevices_) {
    if (device.expired()) continue;
    if (device.expired() || (device.lock().get()->GetConnectionState() !=
                             DeviceConnectState::CONNECTED))
      continue;
    updated_audio_directions |= device.lock().get()->audio_directions_;
  }