Skip to content
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

Add an initial, very simple, jitter buffer #222

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Conversation

thatsnotright
Copy link
Contributor

Description

This PR adds a very simple jitter buffer for RTP packets. The goal of this is to slowly introduce jitter buffers in places which network jitter can critically impact stream performance without causing unnecessary delay. Right now the heuristic is set at a fixed packet count before moving to the playback state, but this algorithm will be adjusted (and additional dynamic algorithms introduced) in future work.

This jitter buffer relies on a priority queue based on the RTP packet's sequence number. It will insert new packets in priority of sequence number, tracks when its current simplistic total packet count is met to emit a playback event and allows Pop-ing packets off either from the play head (defined as the head position when the jitter buffer met its minimum length) or at a specific timestamp.

For elements which need to exhaust all packets at a specific timestamp, call PopAtTimestamp with the timestamp in a loop and wait for an error response.

More to come, statistics suggestions welcome, as well as any other feedback on approach or suggested algorithms.

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (450ac84) 79.73% compared to head (00d52dd) 79.83%.

Files Patch % Lines
pkg/jitterbuffer/jitter_buffer.go 72.72% 19 Missing and 5 partials ⚠️
pkg/jitterbuffer/priority_queue.go 85.96% 12 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   79.73%   79.83%   +0.10%     
==========================================
  Files          68       70       +2     
  Lines        3587     3789     +202     
==========================================
+ Hits         2860     3025     +165     
- Misses        602      631      +29     
- Partials      125      133       +8     
Flag Coverage Δ
go 79.83% <80.19%> (+0.18%) ⬆️
wasm 77.67% <80.19%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thatsnotright
Copy link
Contributor Author

I will work on code coverage, there are a few spots which should get tested that I missed.

@thatsnotright thatsnotright force-pushed the rob/jitterbuffer branch 9 times, most recently from d542292 to 3f72d4b Compare January 25, 2024 00:16
A Priority Queue JitterBuffer that will be used to back the
SampleBuilder and a new Interceptor
@Sean-Der Sean-Der merged commit d9d223e into master Jan 26, 2024
13 of 14 checks passed
@Sean-Der Sean-Der deleted the rob/jitterbuffer branch January 26, 2024 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants