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

jitterbuffer: Use jitterbuffer in SampleBuilder #2959

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thatsnotright
Copy link

Description

Reference issue

Fixes #...

@thatsnotright thatsnotright requested a review from at-wat November 26, 2024 23:49
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 80.64516% with 6 lines in your changes missing coverage. Please review.

Project coverage is 77.62%. Comparing base (271ab55) to head (9b32354).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
pkg/media/samplebuilder/samplebuilder.go 80.64% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2959      +/-   ##
==========================================
- Coverage   79.01%   77.62%   -1.40%     
==========================================
  Files          89       89              
  Lines        8584    10529    +1945     
==========================================
+ Hits         6783     8173    +1390     
- Misses       1311     1859     +548     
- Partials      490      497       +7     
Flag Coverage Δ
go 79.17% <80.64%> (-1.40%) ⬇️
wasm 63.54% <80.64%> (-0.26%) ⬇️

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.

@jech
Copy link
Member

jech commented Jan 8, 2025

The current JitterBuffer induces a fixed delay of 50 packets. I don't think that it's a good idea to use it in SampleBuilder until that is fixed.

@thatsnotright
Copy link
Author

The current JitterBuffer induces a fixed delay of 50 packets. I don't think that it's a good idea to use it in SampleBuilder until that is fixed.

@jech What would you propose the interface look like, or mechanism be for adjusting that delay?

@jech
Copy link
Member

jech commented Jan 22, 2025

What would you propose the interface look like, or mechanism be for adjusting that delay?

Before we discuss the interface, we need to understand what is required.

For an interactive display, the jitter buffer delay should be set to something like smoothed_RTT + 4*variance(RTT). The RTT and its variance can be recomputed at various times: when we receive a receiver report, when we receive TWCC feedback, or when we receive an ICE consent. Yeah, it's a mess.

What is more, the delay might be influenced by external factors, such as when a receiver is performing audio-video sync.

For the samplebuilder, the amount of delay will depend on the application: it will be as above for low-latency applications, but it can be much larger than that for semi-interactive applications (such as streaming). For non-interactive applications, such as saving to disk, there is no need for a fixed delay, the samplebuilder can add as much delay as required to avoid packet loss.

In summary: there are many contradictory requirements, and meeting them all without having dozens of special cases will require good taste and careful thought. I am not able to propose a fully general interface at this time.

@Sean-Der
Copy link
Member

@jech This is the behavior we have today (unfortunately)

I agree we should improve it! We shouldn't block merging this for that though.

Correct me if I'm am wrong @thatsnotright, but this causes 0 behavior change. We are just trying to push as much 'RTP code' into pion/interceptor. That lets people doing non-WebRTC things use it also.

@thatsnotright
Copy link
Author

Correct me if I'm am wrong @thatsnotright, but this causes 0 behavior change.

Aside from potentially a little more delay there shouldn't be, it was designed to strictly replace how the current SampleBuilder buffered packets. It should reduce the amount of memory used.

@jech
Copy link
Member

jech commented Jan 26, 2025 via email

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.

3 participants