简体   繁体   English

WebRTC Android:电话扬声器的声音通过电话麦克风进入会议并引起回声

[英]WebRTC Android: sound from phone speaker is going into conference through phone mic and causing echo

In some mobile devices(like Motorola One Power - Android 10, Redmi Note 5 Pro - Android 7.1.2), sound from phone speaker is going into conference through phone mic and causing echo.在某些移动设备中(例如 Motorola One Power - Android 10、Redmi Note 5 Pro - Android 7.1.2),来自电话扬声器的声音通过电话麦克风进入会议并引起回声。 This echo issue is coming only when Phone Speaker is in ON state.仅当电话扬声器处于 ON state 时才会出现此回声问题。

I have used MODE_IN_COMMUNICATION mode of AudioManager:我使用了 AudioManager 的 MODE_IN_COMMUNICATION 模式:

mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);

Also, used below audio constraints to create Audio Source by using createAudioSource() API of PeerConnectionFactory:此外,在以下音频约束下使用 PeerConnectionFactory 的 createAudioSource() API 创建音频源:

audioConstraints = new MediaConstraints();
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googHighpassFilter", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression", "true"));

Any help or guidance in resolving the issue will be well appreciated.解决问题的任何帮助或指导将不胜感激。

Some phones can't do hardware echo cancellation, even though they advertise it's available.有些手机无法进行硬件回声消除,即使他们宣传它是可用的。 Redmi Note 5 is definitely one of them, take a look at https://github.com/signalapp/Signal-Android/blob/master/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java , search for HARDWARE_AEC_BLACKLIST. Redmi Note 5肯定是其中之一,看看https://github.com/signalapp/Signal-Android/blob/master/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java ,搜索对于 HARDWARE_AEC_BLACKLIST。 So, to enable WebRTC AEC, use below methods of JavaAudioDeviceModule.class因此,要启用 WebRTC AEC,请使用以下 JavaAudioDeviceModule.class 方法

setUseHardwareAcousticEchoCanceler(false)       
setUseHardwareNoiseSuppressor(false) 

(For reference, please have a look into createJavaAudioDevice() of PeerConnectionClient.java - Checkout official android example on googlesource.com (作为参考,请查看 PeerConnectionClient.java 的 createJavaAudioDevice() - 在 googlesource.com 上查看官方 android 示例

Android AudioManager it provides access to volume and ringer mode control. Android AudioManager它提供对音量和振铃模式控制的访问。

First of all find out whether microphone is on or off using isMicrophoneMute() method.首先使用isMicrophoneMute()方法找出麦克风是打开还是关闭。

the find out all the connected audio devices with the help getDevices() which will help to figure out which mic user want to mute借助getDevices()找出所有连接的音频设备,这将有助于确定哪个麦克风用户想要静音

Once you detect targeted mic, Sets the microphone mute using setMicrophoneMute()检测到目标麦克风后,使用setMicrophoneMute()设置麦克风静音

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM