summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioSystem.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-07-09 14:52:47 -0700
committerEric Laurent <elaurent@google.com>2015-07-10 10:58:41 -0700
commit7c1ec5f038e63a5eb8b04434577c25bc23f5f410 (patch)
treef6b8feda43ba0bb6666171b57318ad3cea48a45e /media/libmedia/AudioSystem.cpp
parent54c0659b9efa72d11997c590c4d377c44789c7fd (diff)
downloadframeworks_av-7c1ec5f038e63a5eb8b04434577c25bc23f5f410.zip
frameworks_av-7c1ec5f038e63a5eb8b04434577c25bc23f5f410.tar.gz
frameworks_av-7c1ec5f038e63a5eb8b04434577c25bc23f5f410.tar.bz2
audio: several fixes in audio routing callbacks
- audio policy: Force device change to ensure new audio patch creation upon first track activity on a given output. Fix function device_distinguishes_on_address() which could mistake some output device with remote submix input device. - audio flinger: Reduce number of binder calls upon new client registration by only sending ioConfigChanged() callbacks to newly registered client. Fix first patch after output thread creation not triggering an ioConfigChanged() callback. -audio system: Force client registration upon routing callback installation to force new ioConfigChanged() callback from audio flinger. Bug: 22381136. Change-Id: Ieb0d9f92f563a40552eb31bc0499c8ac65f78ce4
Diffstat (limited to 'media/libmedia/AudioSystem.cpp')
-rw-r--r--media/libmedia/AudioSystem.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index f13bcf3..3bfb09a 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -476,11 +476,13 @@ void AudioSystem::AudioFlingerClient::ioConfigChanged(audio_io_config_event even
switch (event) {
case AUDIO_OUTPUT_OPENED:
case AUDIO_INPUT_OPENED: {
- if (getIoDescriptor(ioDesc->mIoHandle) != 0) {
- ALOGV("ioConfigChanged() opening already existing output! %d", ioDesc->mIoHandle);
- break;
+ sp<AudioIoDescriptor> oldDesc = getIoDescriptor(ioDesc->mIoHandle);
+ if (oldDesc == 0) {
+ mIoDescriptors.add(ioDesc->mIoHandle, ioDesc);
+ } else {
+ deviceId = oldDesc->getDeviceId();
+ mIoDescriptors.replaceValueFor(ioDesc->mIoHandle, ioDesc);
}
- mIoDescriptors.add(ioDesc->mIoHandle, ioDesc);
if (ioDesc->getDeviceId() != AUDIO_PORT_HANDLE_NONE) {
deviceId = ioDesc->getDeviceId();
@@ -1074,7 +1076,14 @@ status_t AudioSystem::addAudioDeviceCallback(
if (afc == 0) {
return NO_INIT;
}
- return afc->addAudioDeviceCallback(callback, audioIo);
+ status_t status = afc->addAudioDeviceCallback(callback, audioIo);
+ if (status == NO_ERROR) {
+ const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+ if (af != 0) {
+ af->registerClient(afc);
+ }
+ }
+ return status;
}
status_t AudioSystem::removeAudioDeviceCallback(