hal: check out_snd_device to get a2dp sample rate
There could be one usecase which:
- there're two active streams in AHAL playing on
BT_SCO device;
- then if one of the active stream receives param
"routing=a2dp" and switch path to a2dp, the other
one will also be switched to a2dp as part of
check_usecases_codec_backend, but the out device is
still BT_SCO;
- so the app sample rate get for this output is wrong.
Instead of checking out device, check snd_device for
querying app sample rate.
Change-Id: Icb7dbba8dc24ee8e5611b1e813e0e4aa2aa3f990
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index d3335a7..4675fc3 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -1077,7 +1077,9 @@
(usecase->stream.out->sample_rate < OUTPUT_SAMPLING_RATE_44100)) {
/* Reset to default if no native stream is active*/
usecase->stream.out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
- } else if (usecase->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) {
+ } else if (usecase->out_snd_device == SND_DEVICE_OUT_BT_A2DP ||
+ usecase->out_snd_device == SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP ||
+ usecase->out_snd_device == SND_DEVICE_OUT_SPEAKER_SAFE_AND_BT_A2DP) {
/*
* For a2dp playback get encoder sampling rate and set copp sampling rate,
* for bit width use the stream param only.