Skip to content

Conversation

@cboulay
Copy link
Collaborator

@cboulay cboulay commented Apr 8, 2021

(this is a dup of #121, rebased on master after some CI fixes)

Very low rate streams combined with smallish max_buflen will give a queue size that gets truncated to 0. The result was a stream that kept disconnecting (at least that's what the log said). Here we + 1 to round up.

For situations where 0 < (nominal_srate() * max_buflen) % 1 < 0.5 , this PR actually gives you a queue length that's longer and less accurate (by 1) than before the change. For the rest of the situations, this is now more accurate. In sum, this is arguably better because it errs on the more conservative side (larger queue).

I started off using std::max(1, {old result}), which is closest to preserving old behaviour and just catching this error case, but it's probably a bit heavy to #include<algorithm> for such a simple fix.

@cboulay cboulay merged commit ddfa301 into master Apr 8, 2021
@tstenner tstenner deleted the nonzero_maxbuflen branch April 9, 2021 06:53
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.

2 participants