AudioFlinger: update cache in/out configuration on device port id change
In case of creation of AudioPatch with the same device type but a different
device id (typically: a device has been connected / disconnection, so
removed and re-attached to its corresponding module, a new Id is assigned),
the cache configuration of the clients is not updated.
If the client calls getRoutedDevice, the id will not be up to date and even
may refer to unknown port id.
Test: as follows:
1 / Calls setDeviceConnectionState AUDIO_DEVICE_OUT_HDMI state=1 mame=y_dummy_hdmi @=my_dummy_hdmi
2 / Plays explicititely on this device (by getting the id
AudioSystem::listAudioPorts
2 / Calls setDeviceConnectionState AUDIO_DEVICE_OUT_HDMI state=0
3 / Calls setDeviceConnectionState AUDIO_DEVICE_OUT_HDMI state=1 mame=y_dummy_hdmi @=my_dummy_hdmi
Plays explicititely on this device (by getting the id
AudioSystem::listAudioPorts
4 / Calls AudioTrack->getRoutedDeviceId()
The id shall match the second one, NOT the first one
that does not exist any more
Change-Id: I608ed8d78907b5ea1c9b6ef13c6cbfe528d88f44
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index e8b2158..5d06773 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -485,6 +485,10 @@
audio_devices_t mPrevOutDevice; // previous output device
audio_devices_t mPrevInDevice; // previous input device
struct audio_patch mPatch;
+ /**
+ * @brief mDeviceId current device port unique identifier
+ */
+ audio_port_handle_t mDeviceId = AUDIO_PORT_HANDLE_NONE;
audio_source_t mAudioSource;
const audio_io_handle_t mId;
@@ -1704,7 +1708,6 @@
audio_attributes_t mAttr;
audio_session_t mSessionId;
- audio_port_handle_t mDeviceId;
audio_port_handle_t mPortId;
wp<MmapStreamCallback> mCallback;