Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LENA][11][4.19] Echo cancellation is not enabled for voice calls #771

Open
Tracked by #46 ...
sledges opened this issue Apr 13, 2022 · 14 comments
Open
Tracked by #46 ...

[LENA][11][4.19] Echo cancellation is not enabled for voice calls #771

sledges opened this issue Apr 13, 2022 · 14 comments
Labels

Comments

@sledges
Copy link

sledges commented Apr 13, 2022

Platform: lena
Device: pdx213 xqbt52 (Xperia 10 III)
Kernel version: 4.19.188-gadf298fa3900
Android version: AOSP11 android-11.0.0_r46
Software binaries version: SW_binaries_for_Xperia_Android_11_4.19_v9a_lena.img

Previously working on stock Sony Android 62.0.A.3.70 (also when reflashed via Emma to 62.0.A.3.109).

Description
Echo cancellation does not work during phone call.

Symptoms
Caller can hear their own voice when they make a call to Xperia 10 III (lena).

How to reproduce
Make a phone call and ask the 3rd party to speak. They should not hear their own voice echoing back, but they do.

@sledges sledges added the bug label Apr 13, 2022
@jerpelea
Copy link
Collaborator

jerpelea commented Apr 13, 2022

please compare the acdb ID used in stock with the ones used by AOSP

@sledges
Copy link
Author

sledges commented Apr 13, 2022

Logs during phonecall:

Stock:

$ adb logcat | grep ACDB | grep acdb_id -w
...
04-13 14:01:19.652   961  8581 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path = 0, app id = 0x11131, sample rate = 48000, afe_sample_rate = 48000
04-13 14:01:19.652   961  8581 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[14] app_type[69937]
04-13 14:01:19.652   961  8581 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[16] acdb_id[14]
04-13 14:01:19.652   961  8581 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 14 path = 0
04-13 14:01:23.650   961  1023 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[17] acdb_id[41]
04-13 14:01:23.650   961  1023 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[16] acdb_id[7]
04-13 14:01:23.650   961  1023 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 41 path = 1
04-13 14:01:23.650   961  1023 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 7 path = 0
04-13 14:01:23.820   961  1023 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 7, path = 0, app id = 0x11131, sample rate = 48000, afe_sample_rate = 48000
04-13 14:01:23.821   961  1023 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[7] app_type[69937]

AOSP:

$ adb logcat | grep ACDB | grep acdb_id -w
...
01-19 18:30:42.398   739  2562 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[124] app_type[69937]
01-19 18:30:42.398   739  2562 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[16] acdb_id[124]
01-19 18:30:42.399   739  2562 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 124 path = 0
01-19 18:30:46.303   739   739 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[17] acdb_id[41]
01-19 18:30:46.303   739   739 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[16] acdb_id[7]
01-19 18:30:46.303   739   739 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 41 path = 1
01-19 18:30:46.303   739   739 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 7 path = 0
01-19 18:30:46.465   739   739 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 7, path = 0, app id = 0x11131, sample rate = 48000, afe_sample_rate = 48000
01-19 18:30:46.465   739   739 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[7] app_type[69937]

@sledges
Copy link
Author

sledges commented May 4, 2022

While following sonyxperiadev/device-sony-seine@44f723e, here are more relevant acdb logs, that happen when switching on loudspeaker mode during phone call:
AOSP:

audio_hw_primary: select_devices: changing use case voicemmode2-call output device from(20: voice-handset, acdb 7) to (21: voice-speaker, acdb 101)
audio_hw_primary: select_devices: changing use case voicemmode2-call input device from(171: voice-dmic-ef, acdb 41) to (174: voice-speaker-dmic-ef, acdb 43)

Stock:

audio_hw_primary: select_devices: changing use case voicemmode2-call output device from(27: voice-handset, acdb 7) to (31: voice-speaker-stereo, acdb 15)
audio_hw_primary: select_devices: changing use case voicemmode2-call input device from(195: voice-dmic-ef, acdb 41) to (178: voice-speaker-mic, acdb 11)

PR created to enable loudspeaker echo cancellation: sonyxperiadev/device-sony-lena#14.
To make sense, will have to be merged also with enabling mic for the loudspeaker: sonyxperiadev/device-sony-pdx213#7.

@sledges
Copy link
Author

sledges commented May 4, 2022

I have however failed to enable echo cancellation for the ordinary phone call (via built-in speaker), even after reverting portions of acdb_ids from sonyxperiadev/device-sony-lena@ec26526 which appeared seemingly relevant to an untrained eye (i.e. myself).

Namely because there is no difference in acdb IDs between AOSP and Stock when phone call is initiated (you can see them both being switched away from voice-handset, acdb 7 output and voice-dmic-ef, acdb 41 input in the logs of previous comment), thus I would not know where else to look.. Pointers always appreciated:)

@sledges
Copy link
Author

sledges commented May 10, 2022

Namely because there is no difference in acdb IDs between AOSP and Stock when phone call is initiated

Due to above reading this comment it seems that it won't be possible to fix this for phone calls..

@mjun
Copy link

mjun commented Feb 2, 2023

@sonyxperiadev this looks like one of those bug we, the community, will not be able to fix easily without Sony help. As this bug does not exist in stock sony ROM can you please provide a fix for this? Thanks

@Thaodan
Copy link

Thaodan commented Feb 17, 2023

The Edo Platform PDX203/PDX206 is also affected by this issue. Is one issue enough for all affected platforms?

@pasikarkkainen
Copy link

I'm curious if there are any updates to getting this issue fixed? Thanks!

@jerpelea
Copy link
Collaborator

unfortunately not yet

@Segment0895
Copy link

If anyone else avoided buying the device because of this bug, place a thumbs up here.

1 similar comment
@Segment0895
Copy link

If anyone else avoided buying the device because of this bug, place a thumbs up here.

@sledges
Copy link
Author

sledges commented Feb 28, 2024

Here is a terrible workaround, which introduces a bigger bug, which at least can be avoided by never turning loudspeaker on:

cd <where_you_uploaded_the_raw_image>
mkdir odm12
mount -o remount,rw /odm/
mount SW_binaries_for_Xperia_Android_12_4.19_v3a_lena.img.raw odm12/
cp -a odm12/lib64/libaudcal.so /odm/lib64/ -vi
# ^ answer "y" to overwrite confirmation
umount odm12
rmdir odm12
sync
reboot

After rebooting the echo cancellation should now work. BUT! If you ever enable loudspeaker (especially during the "Ringing" phase of the phone call), the caller will hear their echo VERY VERY LOUDLY, AND even after you disable loudspeaker, it will persist until next reboot.

So to be able to live life with your Xperia 10 III and make phone-calls without caller hearing the echo, do not use the loudspeaker feature altogether.

P.S. If you believe you did something wrong during the above steps, please just reflash the oem_a and oem_b partitions, and it will revert any changes you've made.

Background story (long read):

I could not live with this bug, because callers would hear their echo even through my headphones.
So I dug deep into experiments with binary blobs, and after some divide'n'conquer, discovered it was the calibration library that was at fault with AOSP 11, that I was able to fix by taking the file from AOSP 12 binaries.
It worked and I was about to post my solution, unfortunately, sometimes I would get complaints from callers that they can hear their voice echoing super loudly, making them extra angry :/
Spent even more months trying to call myself from another phone and testing, until realised that the 100-times worse echo (than originally in this bug) is caused by triggering loudspeaker during the "ringing" phase of the phone call (that's the 100% way to recreate this bug).
Thus I avoided the use-case of tapping on loudspeaker during early seconds of making the call, but I did occasionally enable it during the call (as we do). I was still getting complaints (albeit rarely, e.g. once a week), that people still start hearing their extra loud voice echoing back. I then had to reboot the device to get rid of that state.
I have since stopped using loudspeaker function completely, and not had an issue since, thus after many weeks of testing, I'm happy to share this with you, however at a price of sacrificing the loudspeaker ability.

I have also tried to extract the binary blobs from Sony's stock Android 11 and 12 (with greater difficulties), but replacing libaudcal.so from there was not enough, perhaps other files need to be included, but this goes way beyond my bandwidth to blindly poke at closed bits.

If anyone has more patience/braveness, it might be possible to re-test with Android 13 SW binaries for lena (v1 and v2), and share your findings here.
I'm not sure that when (or if) we find a bug-free combo of those binaries, Sony could back-port them into AOSP 11 binary image, but until then it will remain just as a scriptlet above.

@lkraav
Copy link

lkraav commented Feb 29, 2024

At https://forum.sailfishos.org/t/android-13-and-sailfishos-on-xperia-10-iii/17431 user Wetab73 is reporting great successes of "everything bug free: no echo, no tint, etc" just flashing Android 13 AOSP under SFOS. Not sure if he's tested the loudspeaker like this 🤔

I am on A11 AOSP and for whatever reason not experiencing the echo bug. But same, not sure if I've tested the loudspeaker like you describe. Will report back with data at one point.

@Thaodan
Copy link

Thaodan commented Apr 28, 2024

I noticed on Xperia 1/5 II (Edo) calling with headphones works much better, I'm not sure if echo cancellation is involved here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants