Merge "audio policy: make input device selection more consistent" into pi-dev

gugelfrei
Eric Laurent 6 years ago committed by Android (Google) Code Review
commit 258fb48d14

@ -613,6 +613,23 @@ audio_devices_t Engine::getDeviceForInputSource(audio_source_t inputSource) cons
uint32_t device = AUDIO_DEVICE_NONE;
// when a call is active, force device selection to match source VOICE_COMMUNICATION
// for most other input sources to avoid rerouting call TX audio
if (isInCall()) {
switch (inputSource) {
case AUDIO_SOURCE_DEFAULT:
case AUDIO_SOURCE_MIC:
case AUDIO_SOURCE_VOICE_RECOGNITION:
case AUDIO_SOURCE_UNPROCESSED:
case AUDIO_SOURCE_HOTWORD:
case AUDIO_SOURCE_CAMCORDER:
inputSource = AUDIO_SOURCE_VOICE_COMMUNICATION;
break;
default:
break;
}
}
switch (inputSource) {
case AUDIO_SOURCE_VOICE_UPLINK:
if (availableDeviceTypes & AUDIO_DEVICE_IN_VOICE_CALL) {

@ -4535,10 +4535,13 @@ audio_devices_t AudioPolicyManager::getNewInputDevice(const sp<AudioInputDescrip
}
}
// If we are not in call and no client is active on this input, this methods returns
// AUDIO_DEVICE_NONE, causing the patch on the input stream to be released.
audio_source_t source = inputDesc->getHighestPrioritySource(true /*activeOnly*/);
if (isInCall()) {
device = getDeviceAndMixForInputSource(AUDIO_SOURCE_VOICE_COMMUNICATION);
} else if (source != AUDIO_SOURCE_DEFAULT) {
if (source == AUDIO_SOURCE_DEFAULT && isInCall()) {
source = AUDIO_SOURCE_VOICE_COMMUNICATION;
}
if (source != AUDIO_SOURCE_DEFAULT) {
device = getDeviceAndMixForInputSource(source);
}

Loading…
Cancel
Save