hal: optimize device switch latency with bt headset connected
When BT headset is connected and an output is created, the
BT encoder latency will be be taken into account for overall
output latency. This will append more latency during device
switch, as the output latency represents the buffers to be
drained before switching to a new device.
Exclude the encoder latency when creating the output instance,
then the output latency can reflect to actual buffer size in
driver and dsp.
Change-Id: I94109f58f9e7fe69bec4a46d1f7f12558f1cb91a
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 4ebee70..29fb066 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -5353,7 +5353,7 @@
(out->config.rate);
}
- if (is_a2dp_out_device_type(&out->device_list))
+ if (!out->standby && is_a2dp_out_device_type(&out->device_list))
latency += audio_extn_a2dp_get_encoder_latency();
ALOGV("%s: Latency %d", __func__, latency);