-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Summary
I've noticed that the @roamhq/wrtc package doesn't currently expose some of the jitter buffer statistics that were introduced in Chrome M115+ WebRTC implementation. I'm wondering if there are any plans to support these statistics in future releases?
These statistics would be incredibly helpful for monitoring audio quality, debugging network issues, and optimizing real-time communication applications.
Statistics Fields of Interest
Based on the WebRTC Statistics Identifiers specification and Chrome M115+ implementation, I'm particularly interested in these jitter buffer statistics:
RTCInboundRtpStreamStats
jitterBufferMinimumDelay(double): The minimum delay (in seconds) introduced by the jitter bufferjitterBufferTargetDelay(double): The target delay (in seconds) for the jitter bufferjitterBufferEmittedCount(unsigned long long): Total number of audio samples emitted by the jitter bufferjitterBufferDelay(double): The sum of the time each audio sample spent in the jitter buffertotalSamplesReceived(unsigned long long): Total number of audio samples receivedconcealedSamples(unsigned long long): Number of concealed audio samplessilentConcealedSamples(unsigned long long): Number of silent concealed samplesconcealmentEvents(unsigned long long): Number of concealment eventsinsertedSamplesForDeceleration(unsigned long long): Samples inserted for decelerationremovedSamplesForAcceleration(unsigned long long): Samples removed for acceleration
RTCRemoteInboundRtpStreamStats
jitter(double): Packet jitter measured in secondsfractionLost(double): Fraction of RTP packets lost
Why These Statistics Would Be Valuable
Having access to these statistics would help with:
Audio Quality Monitoring
- Measuring jitter buffer effectiveness
- Monitoring audio concealment events
- Detecting sample rate adjustments
Network Diagnostics
- Packet loss fraction measurements
- Jitter measurements for network condition assessment
- Better debugging of audio quality issues
Performance Optimization
- Tuning jitter buffer parameters based on real conditions
- Providing metrics for adaptive bitrate algorithms
- Enhanced insight into end-to-end audio pipeline performance
Our Use Cases
We're particularly interested in these statistics for:
- Meeting Quality Analytics: Understanding why audio quality degrades
- Network Monitoring: Detecting network congestion and packet loss
- Real-time Diagnostics: Providing users with connection quality feedback
- Performance Tuning: Optimizing jitter buffer settings for different network conditions
- Compliance: Meeting telecommunications quality standards
Comparison with Browser Implementation
Modern browsers (Chrome M115+, Firefox, Safari) expose these statistics through the standard WebRTC Stats API:
// Browser WebRTC Stats API
pc.getStats().then(stats => {
stats.forEach(report => {
if (report.type === 'inbound-rtp' && report.mediaType === 'audio') {
console.log('Jitter Buffer Minimum Delay:', report.jitterBufferMinimumDelay);
console.log('Jitter Buffer Target Delay:', report.jitterBufferTargetDelay);
console.log('Concealed Samples:', report.concealedSamples);
// ... other jitter statistics
}
});
});Potential Implementation Approach
If you're considering adding support for these statistics, we thought a phased approach might work well:
Phase 1: Core Jitter Statistics
The most critical ones might be:
jitterBufferMinimumDelayjitterBufferTargetDelayjitter(for remote inbound stats)concealedSamples
Phase 2: Extended Audio Quality Metrics
Additional audio quality statistics could include:
jitterBufferEmittedCounttotalSamplesReceivedconcealmentEvents- Sample adjustment metrics
Phase 3: Complete Standards Compliance
Eventually achieving full compatibility with WebRTC Statistics specification for jitter-related fields.
Of course, this is just a suggestion - you know the codebase best!
Questions About Implementation
I'm curious about a few things:
Underlying Library Support
Do you know if the underlying native WebRTC library (libwebrtc) currently exposes these statistics? I believe recent versions should include these fields.
API Design
Would these statistics fit naturally into the existing @roamhq/wrtc API design? For example:
// How these might fit into the existing API
pc.getStats((err, stats) => {
stats.forEach(stat => {
if (stat.type === 'inbound-rtp') {
// New jitter buffer fields would be available here
console.log(stat.jitterBufferMinimumDelay);
console.log(stat.concealedSamples);
}
});
});Backward Compatibility
I imagine these would be additive fields that wouldn't break existing applications?
Potential Benefits
If these statistics were available, they could help the community with:
- Better Debug Capabilities: Developers could more easily diagnose audio issues
- Quality Monitoring: Applications could provide real-time quality feedback
- Standards Alignment: Keeping pace with modern WebRTC implementations
- Enterprise Use Cases: Supporting professional conferencing and telecommunications applications
References
- WebRTC Statistics Identifiers Specification
- Chrome M115 WebRTC Stats Changes
- MDN WebRTC Statistics API
- WebRTC Native API Documentation
Environment
- Package:
@roamhq/wrtc - Node.js Version: [Specify your version]
- Platform: [Specify your platform]
- Use Case: Real-time audio quality monitoring and network diagnostics
Thank you so much for maintaining this excellent WebRTC implementation for Node.js! We really appreciate all the work you've put into it.
Main Question: Are there any plans to support these jitter buffer statistics in future releases? Or is this something that might be considered for the roadmap?
Thanks again for all your great work! 🙏