我希望在安卓上实现语音和视频通话。我使用了这个示例项目作为参考:Amazon Kinesis Video Streams Android WebRTC SDK。
问题是麦克风会捕捉到远程的声音,导致极度的回声效果。
我们使用的是这个版本:
org.webrtc:google-webrtc:1.0.30039
AudioManager处于此模式:
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(false);
这是我们尝试过但没有效果的方法:
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
WebRtcAudioUtils.useWebRtcBasedAcousticEchoCanceler();
WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true);
WebRtcAudioUtils.useWebRtcBasedAutomaticGainControl();
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);
WebRtcAudioUtils.useWebRtcBasedNoiseSuppressor();
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
还有这个:
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation2", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googDAEchoCancellation", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googTypingNoiseDetection", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAutoGainControl2", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression2", "true"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googAudioMirroring", "false"));
audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair("googHighpassFilter", "true"));
我真的很迷茫。如何在安卓设备上激活回声消除功能?
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
、WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true);
和WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);
,对于JavaAudioDeviceModule,请使用setUseHardwareAcousticEchoCanceler(false)
和setUseHardwareNoiseSuppressor(false)
。 所有其他参数都会降低声学回声消除(AEC),或完全使AEC无法工作。(我真的不明白为什么会这样) - prechtelmimplementation 'org.webrtc:google-webrtc:1.0.32006'
是否包含 WebRtc APM? - Tomer Petel音频通道
或音频引擎
的 AudioTrack,则可以基本上使用 APM 的能力
,它将给出您期望的结果。如果您想开发自己的 WebRtc SDK 来在 Java 层访问 APM 处理自己的数据,则可以访问我的系列文章从头开始开发 WebRtc:(https://medium.com/@BeingOttoman/compile-and-build-webrtc-library-for-android-platform-3216416263fd) , (https://medium.com/@BeingOttoman/simplest-webrtc-debugging-development-environment-for-linux-3d4e4aed54f3) - Muhammad Usman Bashir