Preempt direct track on resource constraint
If a direct output profile has reached its max open count, attempt to
close existing tracks on the profile to service the latest request.
Test: test_steal_exclusive
Test: atest AudioTrackOffloadTest
Test: atest ^#testMultipleAudioTrackOffloadPreemption
Bug: 294525897
Change-Id: If94405b5e92ae4c2e3ee8c97a3a941b3224940cd
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 58e0486..15b03cb 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -2855,7 +2855,9 @@
if (isOffloadedOrDirect_l() || mDoNotReconnect) {
// FIXME re-creation of offloaded and direct tracks is not yet implemented;
- // reconsider enabling for linear PCM encodings when position can be preserved.
+ // Disabled since (1) timestamp correction is not implemented for non-PCM and
+ // (2) We pre-empt existing direct tracks on resource constraint, so these tracks
+ // shouldn't reconnect.
result = DEAD_OBJECT;
return result;
}