-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Optimize reads with buffering #480
Conversation
Pull Request Test Coverage Report for Build 2523
💛 - Coveralls |
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.
This LGTM! You just have some CI issues :(
Does this maintain the lossyStream behavior? If someone isn't pulling it won't block the entire pipeline?
It won't block the pipeline; in fact it will buffer all data. In fact this would cause a memory leak. I can set a max buffer size; it just kind of sucks because there are 3 buffers in the read pipeline (should all of them have a max size?). |
What do you think of only buffering after we have had a single read? We have applications where people get Tracks, but never read them. I think this is fine behavior. |
It's a little custom. You can't drop the packets because you don't know if they're actually going to read. If you revert to the blocking behavior, then it's this strange mode switch triggered by a single read. What if they stop reading from the track later? I would rather just set up a small buffer, like 1MB or something, and start dropping packets once we go over it. This class is really meant to avoid the orchestration and coordination of two goroutines to pass messages. I might still be able to find a way to do it without channels. |
That sounds like a perfect compromise to me @kixelated! The only thing I care about is enabling people to ignore Tracks if they don't care about them. We can also expose something in |
Can we make the buffering configurable/API settable? If someone knows they're not going to read the data they can set it to 0 and otherwise they can tune it for their app. |
1bb5aea
to
db4f1cb
Compare
Can you add some tests that assert that the pipeline properly handles overflow for SRTP? We shouldn't back up the pipeline if we have two tracks but ignore all RTP/RTCP for one. |
Increases the Read performance to acceptable levels. Packet loss went from roughly 8% to 0.5% with this change.
Increases the Read performance to acceptable levels. Packet loss went
from roughly 8% to 0.5% with this change.