audio policy: reduce mute time when invalidating tracks
Replace fixed 2 seconds mute time in checkOutputForStrategy() by
a variable time based on actual maximum output latency.
Also fix problem where src outputs where queried from mOutputs list
instead of from mPreviousOutputs.
Bug: 70632415
Test: manual connections/disconnection of BT A2DP and USB headset
Change-Id: I3a9ea915a134d95a2dc5abea2fbfe6152f147e80
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 2b68882..0df52da 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -67,6 +67,10 @@
// is switched
#define MUTE_TIME_MS 2000
+// multiplication factor applied to output latency when calculating a safe mute delay when
+// invalidating tracks
+#define LATENCY_MUTE_FACTOR 4
+
#define NUM_TEST_OUTPUTS 5
#define NUM_VOL_CURVE_KNEES 2