Skip to content

Synchronize WebRtcAudioRecord.notifyEncodedData (issue #8084) - #8098

Open
jantekb wants to merge 1 commit into
masterfrom
fix/issue8084-audio-native-crash
Open

jantekb wants to merge 1 commit into
masterfrom
fix/issue8084-audio-native-crash

Conversation

@jantekb

@jantekb jantekb commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of the fix for #8084 (JVM crashes with SIGSEGV in WebRTC conferences when participants with audio leave and join).

WebRtcAudioRecord.notifyEncodedData is called concurrently by the WebRTCMuxer threads of all audio tracks a WebRTC client plays. The method used an unsynchronized LinkedHashMap for the per-track direct buffers and called the native EncodedDataIsReady concurrently. This PR makes the method synchronized.

Root cause

The crashes are native heap corruption. The main cause is in the native libjingle_peerconnection_so: AntMediaAudioEncoderFactory kept raw pointers to audio encoders that WebRTC destroys on reconfiguration or teardown, and EncodedDataIsReady wrote into the freed encoders. That is fixed in the native library (branch fix/issue8084-audio-encoder-uaf on the native build server).

notifyEncodedData is called concurrently by the muxer threads of the audio tracks of a WebRTC client. The buffer map was a plain LinkedHashMap and the native side was called concurrently, which contributed to native heap corruption and JVM crashes.
@jantekb
jantekb force-pushed the fix/issue8084-audio-native-crash branch from 5c0e649 to 11951c2 Compare September 24, 2026 15:18
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi Track Conference- Simultaneous track removal causes server hang/crash

1 participant