Fix direct/offload thread output devices into MSD
Without this change, direct/offload threads show
"Output devices: (Empty device types)". Empty device
causes timestamp correction to always be disabled for
output threads requiring timestamp correction.
Test: check direct/offload output into MSD dumpsys output devices
atest audiopolicy_tests
Bug: 159948389
Change-Id: I7006c9da2f0a228dd49ce0297c30035fef983090
diff --git a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
index e1721ea..bdddf06 100644
--- a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
+++ b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
@@ -75,6 +75,10 @@
status_t createAudioPatch(const struct audio_patch *patch,
audio_patch_handle_t *handle,
int /*delayMs*/) override {
+ auto iter = mActivePatches.find(*handle);
+ if (iter != mActivePatches.end()) {
+ mActivePatches.erase(*handle);
+ }
*handle = mNextPatchHandle++;
mActivePatches.insert(std::make_pair(*handle, *patch));
return NO_ERROR;