Requirements
1. Describe the Bug
Summary
When using WebRtcApmModifier with AEC enabled on a FullDuplexDevice, the acoustic echo canceller never receives a far-end reference signal, so ProcessReverseStream is effectively never called and echo cancellation does nothing. Noise suppression (NS) and the high-pass filter still work on the near-end capture stream, which makes the audio sound processed and hides the fact that AEC is a no-op.
Root cause
WebRtcApmModifier wires its internal far-end handler (HandleAudioEngineProcessedForAec, which only acts on Capability.Playback frames) to the FullDuplexDevice/engine OnAudioProcessed event. However, that event is raised only for the capture device path — playback/render devices never raise OnAudioProcessed. As a result the handler is only ever called with capture (near-end) frames, which it ignores, and it is never called with the playback (far-end) frames it actually needs. The reverse stream therefore stays empty and AEC has no reference signal.
Suggested fix
The modifier needs to actually receive the render/playback post-mix as the far-end signal. Either:
- raise the processed-audio event on playback/render devices as well (so the existing
Capability.Playback handler gets fed), or
- inside
WebRtcApmModifier, explicitly drive ProcessReverseStream from the playback device's master mixer instead of relying on the capture-only OnAudioProcessed event.
2. Steps to Reproduce
- Create a
FullDuplexDevice and attach WebRtcApmModifier with aecEnabled: true (NS/HPF on or off — doesn't matter).
- Play back a signal on the playback device while capturing on the mic in a shared acoustic path (speakers audible to the mic).
- Observe that captured audio still contains the full echo of the playback signal — AEC has no effect. Instrumenting
ProcessReverseStream shows it is never called with real render data.
3. Expected Behavior
With aecEnabled: true, the APM's reverse stream should be continuously fed with the render/playback signal (what is being sent to the speakers), so AEC3 can build its reference and cancel echo from the capture stream.
4. Current Behavior
The far-end handler is registered but never invoked with playback audio, so ProcessReverseStream is never driven. AEC produces no cancellation; the caller hears their own echo. Because NS/HPF still run on the near-end, there is no error and the output is not obviously broken — the failure is silent.
5. Minimal Reproducible Example (MRE)
6. Error Messages and Stack Trace (if applicable)
SoundFlow Version
1.4.0
.NET Version
.NET 10.0
Operating System
Windows 11
Architecture
x64
Audio Backend Used (if known)
Full-duplex WASAPI device
Specific Audio Hardware (if relevant)
No response
8. Affected Components/Modules (if known)
SoundFlow.Extensions.WebRtc.Apm 1.4.0
9. Impact
No response
10. Possible Workaround (if known)
I route the playback master-mix into the modifier's private far-end handler ourselves via a small SoundModifier attached to PlaybackDevice.MasterMixer, invoking the internal HandleAudioEngineProcessedForAec with Capability.Playback (currently via reflection, since the method is non-public). The buffer is passed through unmodified. With this in place AEC converges and cancels correctly.
11. Additional Context
No response
Requirements
1. Describe the Bug
Summary
When using
WebRtcApmModifierwith AEC enabled on aFullDuplexDevice, the acoustic echo canceller never receives a far-end reference signal, soProcessReverseStreamis effectively never called and echo cancellation does nothing. Noise suppression (NS) and the high-pass filter still work on the near-end capture stream, which makes the audio sound processed and hides the fact that AEC is a no-op.Root cause
WebRtcApmModifierwires its internal far-end handler (HandleAudioEngineProcessedForAec, which only acts onCapability.Playbackframes) to theFullDuplexDevice/engineOnAudioProcessedevent. However, that event is raised only for the capture device path — playback/render devices never raiseOnAudioProcessed. As a result the handler is only ever called with capture (near-end) frames, which it ignores, and it is never called with the playback (far-end) frames it actually needs. The reverse stream therefore stays empty and AEC has no reference signal.Suggested fix
The modifier needs to actually receive the render/playback post-mix as the far-end signal. Either:
Capability.Playbackhandler gets fed), orWebRtcApmModifier, explicitly driveProcessReverseStreamfrom the playback device's master mixer instead of relying on the capture-onlyOnAudioProcessedevent.2. Steps to Reproduce
FullDuplexDeviceand attachWebRtcApmModifierwithaecEnabled: true(NS/HPF on or off — doesn't matter).ProcessReverseStreamshows it is never called with real render data.3. Expected Behavior
With
aecEnabled: true, the APM's reverse stream should be continuously fed with the render/playback signal (what is being sent to the speakers), so AEC3 can build its reference and cancel echo from the capture stream.4. Current Behavior
The far-end handler is registered but never invoked with playback audio, so
ProcessReverseStreamis never driven. AEC produces no cancellation; the caller hears their own echo. Because NS/HPF still run on the near-end, there is no error and the output is not obviously broken — the failure is silent.5. Minimal Reproducible Example (MRE)
6. Error Messages and Stack Trace (if applicable)
SoundFlow Version
1.4.0
.NET Version
.NET 10.0
Operating System
Windows 11
Architecture
x64
Audio Backend Used (if known)
Full-duplex WASAPI device
Specific Audio Hardware (if relevant)
No response
8. Affected Components/Modules (if known)
SoundFlow.Extensions.WebRtc.Apm1.4.09. Impact
No response
10. Possible Workaround (if known)
I route the playback master-mix into the modifier's private far-end handler ourselves via a small
SoundModifierattached toPlaybackDevice.MasterMixer, invoking the internalHandleAudioEngineProcessedForAecwithCapability.Playback(currently via reflection, since the method is non-public). The buffer is passed through unmodified. With this in place AEC converges and cancels correctly.11. Additional Context
No response