leaudio: Store chosen configuration asap
With this patch we store chosen configuration just when it got chosen
and not when streaming has started. In this way we make sure, this is
a correct configuration.
Bug: 210101068
Bug: 150670922
Test: atest --host bluetooth_le_audio_client_test bluetooth_le_audio_test
Tag: #feature
sponsor: jpawlowski@
Change-Id: Ia7ca46228242b161894189ca0ef459b394bfc6c0
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 2167a06..b208810 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -2039,7 +2039,6 @@
stream_conf->sink_frame_duration_us = frame_duration_us;
stream_conf->sink_octets_per_codec_frame = octets_per_frame;
stream_conf->valid = true;
- stream_conf->conf = group->GetActiveConfiguration();
LOG(INFO) << __func__ << " configuration: " << stream_conf->conf->name;
@@ -2204,8 +2203,6 @@
ase->codec_config.octets_per_codec_frame;
stream_conf->valid = true;
- stream_conf->conf = group->GetActiveConfiguration();
-
LOG(INFO) << __func__ << " Added CIS: " << +ase->cis_conn_hdl
<< " to stream. Allocation: "
<< +ase->codec_config.audio_channel_allocation
diff --git a/system/bta/le_audio/devices.cc b/system/bta/le_audio/devices.cc
index 0fa7329..829ad9c 100644
--- a/system/bta/le_audio/devices.cc
+++ b/system/bta/le_audio/devices.cc
@@ -1156,6 +1156,11 @@
<< ", is in mismatch with cached active contexts";
return false;
}
+
+ /* Store selected configuration at once it is chosen.
+ * It might happen it will get unavailable in some point of time
+ */
+ stream_conf.conf = conf;
return true;
}