update to plugin 7 and refactor (should improve speed)

This commit is contained in:
2024-01-07 17:23:06 +01:00
parent 103f36f2d2
commit f02b03da7c
9 changed files with 37 additions and 19 deletions

View File

@@ -69,8 +69,8 @@ float CUBIC::getWindow(void) {
return std::min<float>(getCWnD(), FlowOnly::getWindow());
}
int64_t CUBIC::canSend(void) {
const auto fspace_pkgs = FlowOnly::canSend();
int64_t CUBIC::canSend(float time_delta) {
const auto fspace_pkgs = FlowOnly::canSend(time_delta);
if (fspace_pkgs == 0u) {
return 0u;
@@ -86,11 +86,6 @@ int64_t CUBIC::canSend(void) {
// this is mostly to prevent spikes on empty windows
const auto rate = window / getCurrentDelay();
// assuming at most 20ms tick interval
// TODO: pass down actual tick interval
//const float time_delta = 0.02f; // 20ms
const float time_delta = 0.01666f;
// we dont want this limit to fall below atleast 1 segment
const int64_t max_bytes_per_tick = std::max<int64_t>(rate * time_delta + 0.5f, MAXIMUM_SEGMENT_SIZE);
cspace_bytes = std::min<int64_t>(cspace_bytes, max_bytes_per_tick);