diff options
Diffstat (limited to 'services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp')
-rw-r--r-- | services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp b/services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp index 4bc3c7f..b8846c6 100644 --- a/services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp +++ b/services/audiopolicy/AudioPolicyInterfaceImplLegacy.cpp @@ -241,14 +241,21 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, if (mpAudioPolicy == NULL) { return NO_INIT; } + + audio_source_t inputSource = attr->source; + // already checked by client, but double-check in case the client wrapper is bypassed - if (attr->source >= AUDIO_SOURCE_CNT && attr->source != AUDIO_SOURCE_HOTWORD && - attr->source != AUDIO_SOURCE_FM_TUNER) { + if (inputSource >= AUDIO_SOURCE_CNT && inputSource != AUDIO_SOURCE_HOTWORD && + inputSource != AUDIO_SOURCE_FM_TUNER) { return BAD_VALUE; } - if (((attr->source == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) || - ((attr->source == AUDIO_SOURCE_FM_TUNER) && !captureFmTunerAllowed())) { + if (inputSource == AUDIO_SOURCE_DEFAULT) { + inputSource = AUDIO_SOURCE_MIC; + } + + if (((inputSource == AUDIO_SOURCE_HOTWORD) && !captureHotwordAllowed()) || + ((inputSource == AUDIO_SOURCE_FM_TUNER) && !captureFmTunerAllowed())) { return BAD_VALUE; } @@ -256,7 +263,7 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, { Mutex::Autolock _l(mLock); // the audio_in_acoustics_t parameter is ignored by get_input() - *input = mpAudioPolicy->get_input(mpAudioPolicy, attr->source, samplingRate, + *input = mpAudioPolicy->get_input(mpAudioPolicy, inputSource, samplingRate, format, channelMask, (audio_in_acoustics_t) 0); audioPolicyEffects = mAudioPolicyEffects; } @@ -266,7 +273,7 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr, if (audioPolicyEffects != 0) { // create audio pre processors according to input source - status_t status = audioPolicyEffects->addInputEffects(*input, attr->source, session); + status_t status = audioPolicyEffects->addInputEffects(*input, inputSource, session); if (status != NO_ERROR && status != ALREADY_EXISTS) { ALOGW("Failed to add effects on input %d", input); } |