diff options
author | Eric Laurent <elaurent@google.com> | 2010-03-11 14:47:00 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-03-16 17:32:18 -0700 |
commit | ef9500fe53b6ec67b610207832b52f8bfbb20cd5 (patch) | |
tree | 00a5eea1602d0a358603b0d4e741b0b51f2a36b5 /media/libmedia/AudioSystem.cpp | |
parent | 1a3786a3e34112e3e68e6a9b07ba72802867a002 (diff) | |
download | frameworks_base-ef9500fe53b6ec67b610207832b52f8bfbb20cd5.zip frameworks_base-ef9500fe53b6ec67b610207832b52f8bfbb20cd5.tar.gz frameworks_base-ef9500fe53b6ec67b610207832b52f8bfbb20cd5.tar.bz2 |
Fix issue 2416481: Support Voice Dialer over BT SCO.
- AudioPolicyManager: allow platform specific choice for opening a direct output.
Also fixed problems in direct output management.
- AudioFliinger: use shorter standby delay and track inactivity grace period for direct output
thread to free hardware resources as soon as possible.
- AudioSystem: do not use cached output selection in getOutput() when a direct output
can be selected.
Change-Id: If44b50d29237b8402ffd7a5ba1dc43c56f903e9b
Diffstat (limited to 'media/libmedia/AudioSystem.cpp')
-rw-r--r-- | media/libmedia/AudioSystem.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 4b364f2..5e6ce42 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -358,7 +358,7 @@ unsigned int AudioSystem::getInputFramesLost(audio_io_handle_t ioHandle) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); unsigned int result = 0; if (af == 0) return result; - if (ioHandle == NULL) return result; + if (ioHandle == 0) return result; result = af->getInputFramesLost(ioHandle); return result; @@ -556,7 +556,18 @@ audio_io_handle_t AudioSystem::getOutput(stream_type stream, output_flags flags) { audio_io_handle_t output = 0; - if ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) == 0) { + // Do not use stream to output map cache if the direct output + // flag is set or if we are likely to use a direct output + // (e.g voice call stream @ 8kHz could use BT SCO device and be routed to + // a direct output on some platforms). + // TODO: the output cache and stream to output mapping implementation needs to + // be reworked for proper operation with direct outputs. This code is too specific + // to the first use case we want to cover (Voice Recognition and Voice Dialer over + // Bluetooth SCO + if ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) == 0 && + ((stream != AudioSystem::VOICE_CALL && stream != AudioSystem::BLUETOOTH_SCO) || + channels != AudioSystem::CHANNEL_OUT_MONO || + (samplingRate != 8000 && samplingRate != 16000))) { Mutex::Autolock _l(gLock); output = AudioSystem::gStreamOutputMap.valueFor(stream); LOGV_IF((output != 0), "getOutput() read %d from cache for stream %d", output, stream); |