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

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

leaudio: Workaround for the audio configuration change

This is temporary solution to force Audio Framework to reconfigure the
audio configuration by making device inactive and active again. This
will trigger adev_close() and adev_open() which solves the problem for
the moment.

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: atest --host bluetooth_le_audio_client_test bluetooth_le_audio_test
Change-Id: I14093b5dfc1df0a4da3279a78fa24108a60de881
parent 666b01d6
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -2157,15 +2157,23 @@ class LeAudioClientImpl : public LeAudioClient {
            context_type, le_audio::types::kLeAudioDirectionSource);

    if (source_configuration) {
      bool send_active = false;
      /* Stream configuration differs from previous one */
      if (!current_source_codec_config.IsInvalid() &&
          (*source_configuration != current_source_codec_config))
          (*source_configuration != current_source_codec_config)) {
        callbacks_->OnGroupStatus(group_id, GroupStatus::INACTIVE);
        send_active = true;
        LeAudioClientAudioSource::Stop();
      }

      current_source_codec_config = *source_configuration;

      LeAudioClientAudioSource::Start(current_source_codec_config,
                                      audioSinkReceiver);
      if (send_active) {
        callbacks_->OnGroupStatus(group_id, GroupStatus::ACTIVE);
      }

    } else {
      if (!current_source_codec_config.IsInvalid()) {
        LeAudioClientAudioSource::Stop();
@@ -2179,15 +2187,22 @@ class LeAudioClientImpl : public LeAudioClient {
    }

    if (sink_configuration) {
      bool send_active = false;
      /* Stream configuration differs from previous one */
      if (!current_sink_codec_config.IsInvalid() &&
          (*sink_configuration != current_sink_codec_config))
          (*sink_configuration != current_sink_codec_config)) {
        callbacks_->OnGroupStatus(group_id, GroupStatus::INACTIVE);
        send_active = true;
        LeAudioClientAudioSink::Stop();
      }

      current_sink_codec_config = *sink_configuration;

      LeAudioClientAudioSink::Start(current_sink_codec_config,
                                    audioSourceReceiver);
      if (send_active) {
        callbacks_->OnGroupStatus(group_id, GroupStatus::ACTIVE);
      }
    } else {
      if (!current_sink_codec_config.IsInvalid()) {
        LeAudioClientAudioSink::Stop();