summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-09-17 13:40:35 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-09-18 12:21:14 -0700
commit6d3a115c091adc1618b3d1e50a86951c3b35fa30 (patch)
treee12f5347213bca05a08344a53c60c30bff5316c2 /audio
parented8f62d4faa53bbd53a358c5f494b653a09285e4 (diff)
downloadhardware_libhardware_legacy-6d3a115c091adc1618b3d1e50a86951c3b35fa30.zip
hardware_libhardware_legacy-6d3a115c091adc1618b3d1e50a86951c3b35fa30.tar.gz
hardware_libhardware_legacy-6d3a115c091adc1618b3d1e50a86951c3b35fa30.tar.bz2
Support audio recording while remote submix is active
When evaluating if an audio record is active, do not count inputs opened on "virtual" devices, such as remote submix, as active. Change-Id: If19c321cf673e3bdf4c3f81e73c163190df7c21e
Diffstat (limited to 'audio')
-rw-r--r--audio/AudioPolicyManagerBase.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 32de6c1..9625491 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -24,6 +24,10 @@
#define ALOGVV(a...) do { } while(0)
#endif
+// A device mask for all audio input devices that are considered "virtual" when evaluating
+// active inputs in getActiveInput()
+#define APM_AUDIO_IN_DEVICE_VIRTUAL_ALL AUDIO_DEVICE_IN_REMOTE_SUBMIX
+
#include <utils/Log.h>
#include <hardware_legacy/AudioPolicyManagerBase.h>
#include <hardware/audio_effect.h>
@@ -2421,10 +2425,22 @@ audio_devices_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource)
return device;
}
-audio_io_handle_t AudioPolicyManagerBase::getActiveInput()
+bool AudioPolicyManagerBase::isVirtualInputDevice(audio_devices_t device)
+{
+ if ((device & AUDIO_DEVICE_BIT_IN) != 0) {
+ device &= ~AUDIO_DEVICE_BIT_IN;
+ if ((popcount(device) == 1) && ((device & ~APM_AUDIO_IN_DEVICE_VIRTUAL_ALL) == 0))
+ return true;
+ }
+ return false;
+}
+
+audio_io_handle_t AudioPolicyManagerBase::getActiveInput(bool ignoreVirtualInputs)
{
for (size_t i = 0; i < mInputs.size(); i++) {
- if (mInputs.valueAt(i)->mRefCount > 0) {
+ const AudioInputDescriptor * input_descriptor = mInputs.valueAt(i);
+ if ((input_descriptor->mRefCount > 0)
+ && (!ignoreVirtualInputs || !isVirtualInputDevice(input_descriptor->mDevice))) {
return mInputs.keyAt(i);
}
}