-
-
Notifications
You must be signed in to change notification settings - Fork 85
Add audio jitter options to RTCConfiguration #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds three audio jitter buffer configuration options to RTCConfiguration to provide finer control over audio latency and buffering behavior in WebRTC peer connections.
- Added
audioJitterBufferMaxPackets,audioJitterBufferFastAccelerate, andaudioJitterBufferMinDelayMsfields - Implemented JNI bindings to bridge Java configuration to native WebRTC configuration
- Defined constant
kAudioJitterBufferMaxPacketswith default value of 200
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| webrtc/src/main/java/dev/onvoid/webrtc/RTCConfiguration.java | Added three public fields for audio jitter buffer configuration with documentation and a constant for the default max packets value |
| webrtc-jni/src/main/cpp/src/api/RTCConfiguration.cpp | Implemented bidirectional conversion between Java and native types for the new audio jitter buffer fields |
| webrtc-jni/src/main/cpp/include/api/RTCConfiguration.h | Declared jfieldID references for the three new audio jitter buffer fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Whether to use the NetEq "fast mode" which will accelerate audio quicker | ||
| * if it falls behind. |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaDoc comment formatting is inconsistent with the other comments in this file. The opening '/**' should be on its own line, and there should be no leading tabs before the asterisks. This comment should follow the same style as the comments above and below it.
| /** Whether to use the NetEq "fast mode" which will accelerate audio quicker | |
| * if it falls behind. | |
| /** | |
| * Whether to use the NetEq "fast mode" which will accelerate audio quicker | |
| * if it falls behind. |
| env->SetObjectField(config, javaClass->portAllocatorConfig, pac.get()); | ||
|
|
||
| env->SetIntField(config, javaClass->audioJitterBufferMaxPackets, nativeType.audio_jitter_buffer_max_packets); | ||
| env->SetBooleanField(config, javaClass->audioJitterBufferMaxPackets, nativeType.audio_jitter_buffer_fast_accelerate); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect field is being used for the boolean value. The field 'audioJitterBufferMaxPackets' is being set twice (once on line 63 as an int, and again on line 64 as a boolean), while 'audioJitterBufferFastAccelerate' is never set. This should use 'audioJitterBufferFastAccelerate' instead of 'audioJitterBufferMaxPackets'.
| env->SetBooleanField(config, javaClass->audioJitterBufferMaxPackets, nativeType.audio_jitter_buffer_fast_accelerate); | |
| env->SetBooleanField(config, javaClass->audioJitterBufferFastAccelerate, nativeType.audio_jitter_buffer_fast_accelerate); |
| /** | ||
| * The maximum number of packets that can be stored in the NetEq audio | ||
| * jitter buffer. Can be reduced to lower tolerated audio latency. | ||
| */ | ||
| public int audioJitterBufferMaxPackets = kAudioJitterBufferMaxPackets; | ||
|
|
||
| /** Whether to use the NetEq "fast mode" which will accelerate audio quicker | ||
| * if it falls behind. | ||
| */ | ||
| public boolean audioJitterBufferFastAccelerate; | ||
|
|
||
| /** | ||
| * The minimum delay in milliseconds for the audio jitter buffer. | ||
| */ | ||
| public int audioJitterBufferMinDelayMs; |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new audio jitter buffer fields lack test coverage. Based on the existing test pattern in RTCPeerConnectionTests.configuration(), these fields should be tested to verify they are properly round-tripped through the JNI layer (set in Java configuration, create peer connection, retrieve configuration, and verify values match).
Add audio jitter options below:
int audioJitterBufferMaxPackets
boolean audioJitterBufferFastAccelerate
int audioJitterBufferMinDelayMs