Remove abs() use in PseudoTcp::process.

Squelches a clang 3.5 compile error for using abs() with a long instead
of labs(). Updated affected code to use uint32:s to match the sign of
m_rx_srtt.

BUG=
R=fischman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/9409004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5651 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-03-06 18:31:08 +00:00
parent 45846977f9
commit f714e7faea

View File

@ -728,13 +728,16 @@ bool PseudoTcp::process(Segment& seg) {
if ((seg.ack > m_snd_una) && (seg.ack <= m_snd_nxt)) {
// Calculate round-trip time
if (seg.tsecr) {
long rtt = talk_base::TimeDiff(now, seg.tsecr);
int32 rtt = talk_base::TimeDiff(now, seg.tsecr);
if (rtt >= 0) {
if (m_rx_srtt == 0) {
m_rx_srtt = rtt;
m_rx_rttvar = rtt / 2;
} else {
m_rx_rttvar = (3 * m_rx_rttvar + abs(long(rtt - m_rx_srtt))) / 4;
uint32 unsigned_rtt = static_cast<uint32>(rtt);
uint32 abs_err = unsigned_rtt > m_rx_srtt ? unsigned_rtt - m_rx_srtt
: m_rx_srtt - unsigned_rtt;
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 +