Closed GoogleCodeExporter closed 9 years ago
It seems that Android 5.0 for Nexus 4 just ignores Audio Mode ?
Whatever AudioManager::setMode() you set, there is just no difference.
It still operates in 'Normal' mode.
Original comment by bill.out...@gmail.com
on 10 Dec 2014 at 1:02
[deleted comment]
I can confirm this issue with my Nexus 4 (Lollipop). I'm also having the same
issue with my Nexus 7 (2012, Lollipop). On all other devices we own (HTC one
mini and HTC Desire with CyanogenMod) echo cancellation works brilliant.
It seems echo cancellation is working but much too weak. Because there is a
difference in enabling or disabling echo cancellation.
Currentl the trick is to make the micro less sensitive (-4.0 dB).
Original comment by immanuel...@gmail.com
on 2 Jan 2015 at 8:44
It is the same here...
Original comment by rel...@gmail.com
on 2 Jan 2015 at 11:51
Some update on the topic.
My comment #1 was wrong, AudioManager:setMode and AudioRecord modes are working
as expected.
I did some tests with code samples, simple echos with both OpenSL and Java and
here is the thing :
- with 4.4 kitkat and below, using IN_COMMUNICATION + VOICE_COMMUNICATION
triggers automatically the built-in hardware AEC. With both Java & OpenSL
- with Lollipop, this is no longer the case.
This explains why call was fine under Kitkat even with "Echo cancel" setting
disabled.
What are the alternatives ?
- Software Echo cancellers or lower micro gain ?
There is some improvement, but audio call still feels "weird" on the remote
end. Especially with devices (nexus 4) which are very prone to headset echo by
design.
Side note about soft echo cancellers, the less audio latency, the less
efficient they seem ?
Digging the code to see how they work is just over my skills :)
- Using Java audio driver and implement AcousticEchoCanceler in it ?
It works, but there is a -huge- audio latency using this driver. Maybe it is
JNI related, because simple In/out echo using AudioTrack / AudioRecord doesn't
show much latency.
I am trying to rework android_jni_dev to see if latency can be improved.
- Implement AEC in OpenSLES driver ?
Should be the best option but,
* Though SL_IID_ANDROIDEFFECTCAPABILITIES reports an "Acoustic Echo Canceller",
AudioRecorder doesn't expose a SL_IID_ANDROIDEFFECT interface. It seems (in
current OpenSL implementation) it is only possible to apply post-processing
effects.
* Use JNI to attach AcousticEchoCanceler to the OpenSL audio recording session.
Unfortunately OpenSL doesn't provide a way to retrieve the android audio
session ID (even if looking at AOSP this ID actually exists).
I found a really dirty hack to attach AcousticEchoCanceler without knowing the
session ID, and now call is working fine as before.
Still needs to work out releasing the resource when call ends, I will post the
svn diff when it is OK.
On another side note, I took the initiative to insert a 48kHz option so OpenSL
is granted AUDIO_OUTPUT_FLAG_FAST and AUDIO_INPUT_FLAG_FAST, so there's now
near-zero audio latency.
Original comment by bill.out...@gmail.com
on 2 Jan 2015 at 12:21
Despite of the dirty hack in OpenSL_ES this bug should be sheduled against
Google Android imho.
I tried the native Google SIP client. It shows the echo problem very clearly,
while a regular GSM call shows absolutely no echo! So the question raises,
whether the native android AEC can be acessed through an API or if one has to
reimplement AEC a second time in OpenSL ES.
Original comment by immanuel...@gmail.com
on 2 Jan 2015 at 2:04
See :
http://pastebin.com/VuzQ6jD7
Please consider it as an dirty, untested hack. It is not guaranteed to work on
any device but Nexus ones (will likely crash on any other), and even on Nexus
it is not guaranteed to be stable at all !
However hardware AEC is back, and on my N4 prefered settings would be :
- disable (soft)Echo cancel (AEC being already there)
- set sample rate to 48kHz (fast track, reduces latency)
- disable Mode Audio API
- IN_COMMUNICATION / VOICE_COMMUNICATION
- openSL ES
- raise Mic Gain (AEC seems to reduce mic volume)
Regarding bug report to Google, I read hear and there that google has already
been reported that :
- SL_IID_ANDROIDEFFECT cannot be applied to OpenSL recorder
- audioSessionId should be available in OpenSL (it is said in a 2012 post that
"Google is tracking it internally")
I also agree that native SIP is far behind CSipSimple (audio quality, echo,
latency). Unfortunately it doesn't look like a top priority to AOSP...
Original comment by bill.out...@gmail.com
on 3 Jan 2015 at 3:02
Thank you Bill for your very informative posts, as I had no idea why CSIP on
5.0+ sounded so bad on the N4.
Also, a side effect of not using AEC on 5.0+ seems to be increased mic gain
which makes the voice input sound horrible, with the CSIP mic gain manual
control doing little to alleviate it.
For the moment I've just gone back to KitKat, which isn't a great solution but
what can you do.
Original comment by mark.lo...@gmail.com
on 17 May 2015 at 9:35
I suffered a lot, not being able to make echo-free VOIP calls with my N4 5.x.
Fortunately, I rooted my device long time ago. So I was able to do the trick:
/system/vendor/etc/audio_effects.conf
pre_processing {
voice_communication {
aec {}
ns {}
}
}
see: https://code.google.com/p/android/issues/detail?id=62218
BTW: This hack is also removing the echo in native VOIP calls.
Can the Google AEC preprocessing only be accessed by root? Or is there a
possibility to make use of it with user privileges?
I have also a N7 that is not rooted...
Original comment by immanuel...@gmail.com
on 17 May 2015 at 10:14
imannuel does that fix work on lollipop with csipsimple?
Original comment by mark.lo...@gmail.com
on 20 May 2015 at 8:04
Mark: yes I'm using Lollipop 5.1.0 with csipsimple.
Original comment by immanuel...@gmail.com
on 20 May 2015 at 8:36
I can also confirm that immanuel's fix also works on 5.1.1. Thanks again
immanuel.
Original comment by mark.lo...@gmail.com
on 22 May 2015 at 2:28
Original comment by r3gis...@gmail.com
on 22 Jun 2015 at 11:31
Original issue reported on code.google.com by
bill.out...@gmail.com
on 28 Nov 2014 at 2:59