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

Commit 63586d8f authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Łukasz Rymanowski (xWF)
Browse files

leaudio: Speed up reconfiguration between Conversational and Media

To avoid sending Media on the CISes for CONVERSATIONAL, and also
Ringtone on the CISEs for Media, BT stack will reconfigure stream
whenever TBS calls SetInCall().

Bug: 323275279
Bug: 352686917
Test: atest bluetooth_le_audio_client_test
Flag: com.android.bluetooth.flags.leaudio_speed_up_reconfiguration_between_call

Change-Id: I5c42cd1d56a1b05244349fa555f8019d4181e234
parent f2d60893
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -1007,6 +1007,43 @@ public:
  void SetInCall(bool in_call) override {
    log::debug("in_call: {}", in_call);
    in_call_ = in_call;

    if (!com::android::bluetooth::flags::leaudio_speed_up_reconfiguration_between_call()) {
      log::debug("leaudio_speed_up_reconfiguration_between_call flag is not enabled");
      return;
    }

    if (active_group_id_ == bluetooth::groups::kGroupUnknown) {
      return;
    }

    LeAudioDeviceGroup* group = aseGroups_.FindById(active_group_id_);
    if (!group || !group->IsStreaming()) {
      return;
    }

    bool reconfigure = false;

    if (in_call_) {
      auto audio_set_conf = group->GetConfiguration(LeAudioContextType::CONVERSATIONAL);
      if (audio_set_conf && group->IsGroupConfiguredTo(*audio_set_conf)) {
        log::info("Call is coming, but CIG already set for a call");
        return;
      }
      log::info("Call is coming, speed up reconfiguration for a call");
      reconfigure = true;
    } else {
      if (configuration_context_type_ == LeAudioContextType::CONVERSATIONAL) {
        log::info("Call is ended, speed up reconfiguration for media");
        local_metadata_context_types_.sink.unset(LeAudioContextType::CONVERSATIONAL);
        local_metadata_context_types_.source.unset(LeAudioContextType::CONVERSATIONAL);
        reconfigure = true;
      }
    }

    if (reconfigure) {
      initReconfiguration(group, configuration_context_type_);
    }
  }

  bool IsInCall() override { return in_call_; }
+531 −0

File changed.

Preview size limit exceeded, changes collapsed.