diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-11-03 13:39:02 -0800 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-11-03 13:39:02 -0800 |
commit | 28ed8f84d86403cf90b7963b147d2ac5c6cf37c7 (patch) | |
tree | cebb2895642b96aa64e8cf8c2eb402e8423165d6 /indra/llmessage/llthrottle.cpp | |
parent | 9c3595465972ba4be916e871f6b0a62cc0c13d4a (diff) | |
parent | 63b9bd43ff41da01d549f630bd838caff0dffd97 (diff) |
Merge with SVN render-pipeline-8 branch
Diffstat (limited to 'indra/llmessage/llthrottle.cpp')
-rw-r--r-- | indra/llmessage/llthrottle.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 70279a3c62..0872efba50 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -265,6 +265,31 @@ BOOL LLThrottleGroup::setNominalBPS(F32* throttle_vec) return changed; } +// Return bits available in the channel +S32 LLThrottleGroup::getAvailable(S32 throttle_cat) +{ + S32 retval = 0; + + F32 category_bps = mCurrentBPS[throttle_cat]; + F32 lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; + + // use a temporary bits_available + // since we don't want to change mBitsAvailable every time + F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]); + F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time); + + if (bits_available >= lookahead_bits) + { + retval = (S32) gThrottleMaximumBPS[throttle_cat]; + } + else + { + retval = (S32) bits_available; + } + + return retval; +} + BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) { |