三星设备上的AcousticEchoCanceler无法正常工作

eta*_*tan 9 android samsung-mobile echo-cancellation

我有AcousticEchoCanceler用于我试过的所有其他设备类型的VoIP呼叫,但不在任何三星设备上.该设备报告AcousticEchoCanceler可用,但它什么都不做.

我得到了什么:

  • acousticEchoCanceler.setEnabled(true);
  • audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
  • 传递给的音频会话ID AudioTrack
  • 采样率:16k
  • 尝试单声道和立体声录音
  • <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  • <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

有没有人让AcousticEchoCanceler在三星设备上工作?

小智 6

I had the same issue recently. The most important part for me was to use audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION) before creating the AudioRecord.

Next the AudioRecord was created with :

mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION, mSamplingRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, audioRecordBufferSize);
Run Code Online (Sandbox Code Playgroud)

And finally create and enable the NS and AEC :

mNoiseSuppressor = NoiseSuppressor.create(mAudioRecord.getAudioSessionId());
if (mNoiseSuppressor != null) {
    int res = mNoiseSuppressor.setEnabled(true);
}

mAcousticEchoCanceler = AcousticEchoCanceler.create(mAudioRecord.getAudioSessionId());
if (mAcousticEchoCanceler != null) {
    int res = mAcousticEchoCanceler.setEnabled(true);
}
Run Code Online (Sandbox Code Playgroud)

The AudioTrack doesn't need to be associated to same Audio session ID than AudioTrack (I suppose it should be done automatically).


Har*_*ngh 1

尝试这些行:

if (AcousticEchoCanceler.isAvailable() && WebRtcAudioUtils.isAcousticEchoCancelerSupported()) {
                WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
                WebRtcAudioUtils.useWebRtcBasedAcousticEchoCanceler();
            }
Run Code Online (Sandbox Code Playgroud)