Skip to content

Conversation

@singlerr
Copy link

Add audio jitter options below:
int audioJitterBufferMaxPackets
boolean audioJitterBufferFastAccelerate
int audioJitterBufferMinDelayMs

Copilot AI review requested due to automatic review settings December 25, 2025 07:22
Copy link

Copilot AI left a 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, and audioJitterBufferMinDelayMs fields
  • Implemented JNI bindings to bridge Java configuration to native WebRTC configuration
  • Defined constant kAudioJitterBufferMaxPackets with 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.

Comment on lines +78 to +79
/** Whether to use the NetEq "fast mode" which will accelerate audio quicker
* if it falls behind.
Copy link

Copilot AI Dec 25, 2025

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.

Suggested change
/** 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.

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Dec 25, 2025

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'.

Suggested change
env->SetBooleanField(config, javaClass->audioJitterBufferMaxPackets, nativeType.audio_jitter_buffer_fast_accelerate);
env->SetBooleanField(config, javaClass->audioJitterBufferFastAccelerate, nativeType.audio_jitter_buffer_fast_accelerate);

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +86
/**
* 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;
Copy link

Copilot AI Dec 25, 2025

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).

Copilot uses AI. Check for mistakes.
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.

1 participant