diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc')
-rw-r--r-- | third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc b/third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc index 7d8fb9761c..8af77041a5 100644 --- a/third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc +++ b/third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout.cc @@ -12,28 +12,29 @@ #include <algorithm> #include <cstdint> +#include "api/units/time_delta.h" #include "net/dcsctp/public/dcsctp_options.h" namespace dcsctp { RetransmissionTimeout::RetransmissionTimeout(const DcSctpOptions& options) - : min_rto_(*options.rto_min), - max_rto_(*options.rto_max), - max_rtt_(*options.rtt_max), + : min_rto_(options.rto_min.ToTimeDelta()), + max_rto_(options.rto_max.ToTimeDelta()), + max_rtt_(options.rtt_max.ToTimeDelta()), min_rtt_variance_(*options.min_rtt_variance), scaled_srtt_(*options.rto_initial << kRttShift), rto_(*options.rto_initial) {} -void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) { - const int32_t rtt = *measured_rtt; - +void RetransmissionTimeout::ObserveRTT(webrtc::TimeDelta measured_rtt) { // Unrealistic values will be skipped. If a wrongly measured (or otherwise // corrupt) value was processed, it could change the state in a way that would // take a very long time to recover. - if (rtt < 0 || rtt > max_rtt_) { + if (measured_rtt < webrtc::TimeDelta::Zero() || measured_rtt > max_rtt_) { return; } + const int64_t rtt = measured_rtt.ms(); + // From https://tools.ietf.org/html/rfc4960#section-6.3.1, but avoiding // floating point math by implementing algorithm from "V. Jacobson: Congestion // avoidance and control", but adapted for SCTP. @@ -42,7 +43,7 @@ void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) { scaled_rtt_var_ = (rtt / 2) << kRttVarShift; first_measurement_ = false; } else { - int32_t rtt_diff = rtt - (scaled_srtt_ >> kRttShift); + int64_t rtt_diff = rtt - (scaled_srtt_ >> kRttShift); scaled_srtt_ += rtt_diff; if (rtt_diff < 0) { rtt_diff = -rtt_diff; @@ -58,6 +59,6 @@ void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) { rto_ = (scaled_srtt_ >> kRttShift) + scaled_rtt_var_; // Clamp RTO between min and max. - rto_ = std::min(std::max(rto_, min_rto_), max_rto_); + rto_ = std::min(std::max(rto_, min_rto_.ms()), max_rto_.ms()); } } // namespace dcsctp |