How to make software AEC work when using libmediasoupclient?

I am using libmediasoupclient to build my own softaware. And I want to use software AEC not build-in AEC. I refer to the mediasoup-broadcast-demo but I am confused how to combine remote audio track with local send audio track so that I can make the software AEC work?

Hi, I have the same problem. Any solution to solve this question?

The libwebrtc interface you want is AudioDeviceModule. I’m not sure how (or if) libmediasoupclient exposes access to this interface, but this is probably where you should start looking.

I’m using react-native-webrtc and this is how I initialize the module. We use custom settings for each device.

    AudioDeviceModule adm = JavaAudioDeviceModule.builder(reactContext)
            .setUseHardwareAcousticEchoCanceler(settings.hardwareAEC)
            .setUseHardwareNoiseSuppressor(settings.hardwareNoiseSuppressor)
            .createAudioDeviceModule();

    WebRTCModule.Options options = new WebRTCModule.Options();
    options.setAudioDeviceModule(adm);

    return new WebRTCModule(reactContext, options);

Good luck!

Have a look at MediasoupTrackFactory.cpp:

factory = webrtc::CreatePeerConnectionFactory(
	  networkThread,
	  workerThread,
	  signalingThread,
	  fakeAudioCaptureModule,
	  webrtc::CreateBuiltinAudioEncoderFactory(),
	  webrtc::CreateBuiltinAudioDecoderFactory(),
	  webrtc::CreateBuiltinVideoEncoderFactory(),
	  webrtc::CreateBuiltinVideoDecoderFactory(),
	  nullptr /*audio_mixer*/,
	  nullptr /*audio_processing*/);

Hope that helps!