diff options
author | Eric Laurent <elaurent@google.com> | 2011-07-24 13:36:09 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-07-25 14:39:00 -0700 |
commit | 57dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfc (patch) | |
tree | be3ce6819f6a374f914e2c0ec5a837abfe54da5f /services/audioflinger | |
parent | 6d240dc8c5e0bc1ba43a2f5e2f4fc3b5f4ae88db (diff) | |
download | frameworks_av-57dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfc.zip frameworks_av-57dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfc.tar.gz frameworks_av-57dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfc.tar.bz2 |
Added APIs for audio preprocessing
Added APIs to control pre processes applied on captured audio.
Those APIs are still hidden until reviewed by API council.
Three types of standard pre processes are supported:
- Automatic Gain Control (AGC) by AutomaticGainControl class
- Acoustic Echo Cancellation (AEC) by AcousticEchoCanceler class
- Noise Suppression (NS) by NoiseSuppressor class
A method is added to AudioEffect class to query audio pre processings
applied by default by the platform on a given AudioRecord session ID.
Change-Id: I0b9fceeb8c704dd06319c3b52b85c96fe871d51d
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 37 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index dd1e153..6d06d83 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -497,6 +497,43 @@ bool AudioPolicyService::isStreamActive(int stream, uint32_t inPastMs) const return mpAudioPolicy->is_stream_active(mpAudioPolicy, stream, inPastMs); } +status_t AudioPolicyService::queryDefaultPreProcessing(int audioSession, + effect_descriptor_t *descriptors, + uint32_t *count) +{ + + if (mpAudioPolicy == NULL) { + *count = 0; + return NO_INIT; + } + Mutex::Autolock _l(mLock); + status_t status = NO_ERROR; + + size_t index; + for (index = 0; index < mInputs.size(); index++) { + if (mInputs.valueAt(index)->mSessionId == audioSession) { + break; + } + } + if (index == mInputs.size()) { + *count = 0; + return BAD_VALUE; + } + Vector< sp<AudioEffect> > effects = mInputs.valueAt(index)->mEffects; + + for (size_t i = 0; i < effects.size(); i++) { + effect_descriptor_t desc = effects[i]->descriptor(); + if (i < *count) { + memcpy(descriptors + i, &desc, sizeof(effect_descriptor_t)); + } + } + if (effects.size() > *count) { + status = NO_MEMORY; + } + *count = effects.size(); + return status; +} + void AudioPolicyService::binderDied(const wp<IBinder>& who) { LOGW("binderDied() %p, tid %d, calling tid %d", who.unsafe_get(), gettid(), IPCThreadState::self()->getCallingPid()); diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index 62ad29e..834b794 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -104,6 +104,9 @@ public: virtual status_t unregisterEffect(int id); virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const; + virtual status_t queryDefaultPreProcessing(int audioSession, + effect_descriptor_t *descriptors, + uint32_t *count); virtual status_t onTransact( uint32_t code, const Parcel& data, |