OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/p2p/base/pseudotcp.h" | 11 #include "webrtc/p2p/base/pseudotcp.h" |
12 | 12 |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <set> | 17 #include <set> |
18 | 18 |
| 19 #include "webrtc/base/arraysize.h" |
19 #include "webrtc/base/basictypes.h" | 20 #include "webrtc/base/basictypes.h" |
20 #include "webrtc/base/bytebuffer.h" | 21 #include "webrtc/base/bytebuffer.h" |
21 #include "webrtc/base/byteorder.h" | 22 #include "webrtc/base/byteorder.h" |
22 #include "webrtc/base/common.h" | 23 #include "webrtc/base/common.h" |
23 #include "webrtc/base/logging.h" | 24 #include "webrtc/base/logging.h" |
24 #include "webrtc/base/scoped_ptr.h" | 25 #include "webrtc/base/scoped_ptr.h" |
25 #include "webrtc/base/socket.h" | 26 #include "webrtc/base/socket.h" |
26 #include "webrtc/base/stringutils.h" | 27 #include "webrtc/base/stringutils.h" |
27 #include "webrtc/base/timeutils.h" | 28 #include "webrtc/base/timeutils.h" |
28 | 29 |
(...skipping 151 matching lines...) Loading... |
180 "rcv-n", | 181 "rcv-n", |
181 "rcv-o" | 182 "rcv-o" |
182 }; | 183 }; |
183 | 184 |
184 int g_stats[S_NUM_STATS]; | 185 int g_stats[S_NUM_STATS]; |
185 inline void Incr(Stat s) { ++g_stats[s]; } | 186 inline void Incr(Stat s) { ++g_stats[s]; } |
186 void ReportStats() { | 187 void ReportStats() { |
187 char buffer[256]; | 188 char buffer[256]; |
188 size_t len = 0; | 189 size_t len = 0; |
189 for (int i = 0; i < S_NUM_STATS; ++i) { | 190 for (int i = 0; i < S_NUM_STATS; ++i) { |
190 len += rtc::sprintfn(buffer, ARRAY_SIZE(buffer), "%s%s:%d", | 191 len += rtc::sprintfn(buffer, arraysize(buffer), "%s%s:%d", |
191 (i == 0) ? "" : ",", STAT_NAMES[i], g_stats[i]); | 192 (i == 0) ? "" : ",", STAT_NAMES[i], g_stats[i]); |
192 g_stats[i] = 0; | 193 g_stats[i] = 0; |
193 } | 194 } |
194 LOG(LS_INFO) << "Stats[" << buffer << "]"; | 195 LOG(LS_INFO) << "Stats[" << buffer << "]"; |
195 } | 196 } |
196 | 197 |
197 #endif | 198 #endif |
198 | 199 |
199 ////////////////////////////////////////////////////////////////////// | 200 ////////////////////////////////////////////////////////////////////// |
200 // PseudoTcp | 201 // PseudoTcp |
(...skipping 1072 matching lines...) Loading... |
1273 m_rbuf_len = new_size; | 1274 m_rbuf_len = new_size; |
1274 m_rwnd_scale = scale_factor; | 1275 m_rwnd_scale = scale_factor; |
1275 m_ssthresh = new_size; | 1276 m_ssthresh = new_size; |
1276 | 1277 |
1277 size_t available_space = 0; | 1278 size_t available_space = 0; |
1278 m_rbuf.GetWriteRemaining(&available_space); | 1279 m_rbuf.GetWriteRemaining(&available_space); |
1279 m_rcv_wnd = static_cast<uint32_t>(available_space); | 1280 m_rcv_wnd = static_cast<uint32_t>(available_space); |
1280 } | 1281 } |
1281 | 1282 |
1282 } // namespace cricket | 1283 } // namespace cricket |
OLD | NEW |