PreProcessor Effects integration in AudioFlinger

323 views
Skip to first unread message

Hongyan

unread,
Apr 28, 2015, 11:29:48 PM4/28/15
to android...@googlegroups.com

I have a question about the preprocessing effects integration model in

current audio framework, could anyone help on?

 

 

 

 Currently Android provided 3 kinds of preprocessing effects:

 AEC/NS/AGC and they’re wrapped into libaudiopreprocessing.so

 

 When App(Eg: Hangout) created such kind effects (type == what defined

 in libaudiopreprocessing.so), effects will  be created and then handle

 will passed to HAL for further processing.

 

 

 

 SO maybe audio flinger should not call process_l function anymore for

 PRE or PROC effects, right? because they’re suppose to be handled in HAL.

 

 

 

 But in bool AudioFlinger::RecordThread::threadLoop()

 

 

 

 size_t size = effectChains.size();

 

         for (size_t i = 0; i < size; i++) {

 

             // thread mutex is not locked, but effect chain is locked

 

             effectChains[i]->process_l();

 

         }

 

 

 

 All of effects will be processed no matter if it’s PRE or PROC, so

 it’s possible both HAL and Audioflinger called the process function.

 It’s not expected. Is't a bug?

Glenn Kasten

unread,
Apr 29, 2015, 11:04:13 AM4/29/15
to android...@googlegroups.com
The audio input HAL normally runs on the same thread as RecordThread (it is called by RecordThread),
so I think this is OK.  But I will ask others to confirm.

Eric Laurent

unread,
Apr 29, 2015, 12:10:33 PM4/29/15
to android...@googlegroups.com
Current effect implementation in record threads entirely delegates calls to process() (and process_reverse() for AEC) to the audio HAL.
The reason why the EffectChain process_l() function must be called in the thread loop is to update the effect state.

When EffectChain::process_l() calls EffectModule::process() (on each effect), this call is a no op because the effect chain input buffer (and by way of consequence the effect input buffer) is NULL.

See effect chain input buffer init in AudioFlinger::RecordThread::addEffectChain_l() and the test in AudioFlinger::EffectModule::process().

Hongyan

unread,
May 8, 2015, 10:16:29 AM5/8/15
to android...@googlegroups.com
Thank you both. Got your point now. I have another concern and posted another topic, could you help on as well?
在 2015年4月29日星期三 UTC+8上午11:29:48,Hongyan写道:
Reply all
Reply to author
Forward
0 new messages