Index: webrtc/p2p/base/pseudotcp.cc |
diff --git a/webrtc/p2p/base/pseudotcp.cc b/webrtc/p2p/base/pseudotcp.cc |
index 8257b92c310e30d9ef11e0536d85351a68e84ae1..d93f49e394298c2e968a89f5288613ea51b8ed34 100644 |
--- a/webrtc/p2p/base/pseudotcp.cc |
+++ b/webrtc/p2p/base/pseudotcp.cc |
@@ -23,6 +23,7 @@ |
#include "webrtc/base/byteorder.h" |
#include "webrtc/base/checks.h" |
#include "webrtc/base/logging.h" |
+#include "webrtc/base/safe_minmax.h" |
#include "webrtc/base/socket.h" |
#include "webrtc/base/stringutils.h" |
#include "webrtc/base/timeutils.h" |
@@ -155,10 +156,6 @@ inline uint16_t bytes_to_short(const void* buf) { |
return rtc::NetworkToHost16(*static_cast<const uint16_t*>(buf)); |
} |
-uint32_t bound(uint32_t lower, uint32_t middle, uint32_t upper) { |
- return std::min(std::max(lower, middle), upper); |
-} |
- |
////////////////////////////////////////////////////////////////////// |
// Debugging Statistics |
////////////////////////////////////////////////////////////////////// |
@@ -725,9 +722,8 @@ bool PseudoTcp::process(Segment& seg) { |
m_rx_rttvar = (3 * m_rx_rttvar + abs_err) / 4; |
m_rx_srtt = (7 * m_rx_srtt + rtt) / 8; |
} |
- m_rx_rto = |
- bound(MIN_RTO, m_rx_srtt + std::max<uint32_t>(1, 4 * m_rx_rttvar), |
- MAX_RTO); |
+ m_rx_rto = rtc::SafeClamp(m_rx_srtt + rtc::SafeMax(1, 4 * m_rx_rttvar), |
+ MIN_RTO, MAX_RTO); |
#if _DEBUGMSG >= _DBG_VERBOSE |
LOG(LS_INFO) << "rtt: " << rtt |
<< " srtt: " << m_rx_srtt |