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

Commit 173d931a authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

LeAudio: Extend the context alignment policy

In the local source metadata update the context alignment
policy did not take into the account that some of the
bidirectional contexts are only notified on the sink metadata
update event.

Test:  atest --host bluetooth_le_audio_client_test bluetooth_le_audio_test --no-bazel-mode
Change-Id: Ice7bce2640ecd069b24e6f77aae82f5eceef7a35
parent 3e63653e
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -3830,13 +3830,18 @@ class LeAudioClientImpl : public LeAudioClient {
        (audio_receiver_state_ == AudioState::READY_TO_START)) {
      LOG_DEBUG("Other direction is streaming. Taking its contexts %s",
                ToString(metadata_context_types_.source).c_str());

      // If current direction has no valid context take the other direction
      // context
      if (metadata_context_types_.sink.none()) {
        if (metadata_context_types_.source.any()) {
      // If current direction has no valid context or we are in the
      // bidirectional scenario, take the other direction context
      if ((metadata_context_types_.sink.none() &&
           metadata_context_types_.source.any()) ||
          metadata_context_types_.source.test_any(bidir_contexts)) {
        if (osi_property_get_bool(kAllowMultipleContextsInMetadata, true)) {
          LOG_DEBUG("Aligning remote sink metadata to add the source context");
          metadata_context_types_.sink =
              metadata_context_types_.sink | metadata_context_types_.source;
        } else {
          LOG_DEBUG(
              "Aligning remote sink metadata to match the source context");
              "Replacing remote sink metadata to match the source context");
          metadata_context_types_.sink = metadata_context_types_.source;
        }
      }