【问题标题】:WebRTC Android echo cancellationWebRTC Android 回声消除
【发布时间】:2020-10-10 06:28:52
【问题描述】:

我想在android中实现语音和视频通话。我使用这个示例项目作为参考: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"));

我真的迷路了。如何在 android 中激活回声消除?

【问题讨论】:

    标签: android webrtc microphone webrtc-android


    【解决方案1】:

    使用JavaAudioDeviceModule.class的以下方法

    setUseHardwareAcousticEchoCanceler(false)       
    setUseHardwareNoiseSuppressor(false) 
    

    (作为参考,请查看 PeerConnectionClient.java 的 createJavaAudioDevice() - Checkout official android example on googlesource.com 也可以查看 Somesh 的 GitHub 项目(https://github.com/TheSomeshKumar/AndroidWebRTCGradle)。

    【讨论】:

    • 仍然没有成功。还有什么我可以尝试的吗?我使用三星设备进行通话测试,在其他应用中都可以使用回声消除功能。
    • 嗨 @prechtelm 运行代码(在 Somesh 的 Github 项目 (github.com/TheSomeshKumar/AndroidWebRTCGradle) 中设置 setUseHardwareAcousticEchoCanceler(false) 和 setUseHardwareNoiseSuppressor(false) 后,检查您是否在测试设备上收到回声跨度>
    • 非常感谢您的意见!这对我帮助很大!我的解决方案如下所示:只需使用 WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);WebRtcAudioUtils.setWebRtcBasedAutomaticGainControl(true);WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);,对于 JavaAudioDeviceModule 使用:setUseHardwareAcousticEchoCanceler(false)setUseHardwareNoiseSuppressor(false)。所有其他参数都会降低 AEC 或使 AEC 根本不起作用。 (我真的不明白为什么)
    • 记住与SAMPLING RATE相关的一件事。默认情况下,WebRtc AECM 模块仅在8000HZ16000HZ 上提供处理。如果您正在使用48KHz,那么我更愿意查看本教程以了解任何设备上的 WebRtc 音频处理。不同的硬件对APM(Audio Processing Module)有不同的倾向。请访问Android-Audio-Processing-Using-WebRtc
    猜你喜欢
    • 2016-09-20
    • 1970-01-01
    • 2021-01-20
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多