1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > WebRTC Android 回声消除

WebRTC Android 回声消除

时间:2024-01-17 21:50:15

相关推荐

WebRTC Android 回声消除

WebRTC Android 回声消除

前言主体

前言

WebRTC源代码中设计了两个回声消除模块,AEC(Acoustic Echo Canceller)和AECM(Acoustic Echo Canceller Mobile),AEC是在电脑端使用的回声消除器,而AECM是在移动端使用。由于电脑与移动设备的差别比较明显,在处理速度上,编解码器的性能上和内存方面都有着较大的差异。

主体

AudioManager 设置为通话模式,如下:

audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);audioManager.setSpeakerphoneOn(false);

创建 PeerConnect的时候设置如下:

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"));

JavaAudioDeviceModule 创建时进行如下设置:

private JavaAudioDeviceModule audioDeviceModule;private JavaAudioDeviceModule.Builder audioDeviceModuleBuilder;audioDeviceModuleBuilder = JavaAudioDeviceModule.builder(ContextUtils.getApplicationContext());this.audioDeviceModule = audioDeviceModuleBuilder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER).setUseHardwareAcousticEchoCanceler(false).setUseHardwareNoiseSuppressor(false).createAudioDeviceModule();

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。