Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h

Issue 1457023002: Rewrote the PRNG using an xorshift* algorithm and moved the files from test/ to base/. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_ 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_ 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
13 13
14 #include <assert.h> 14 #include <assert.h>
15 #include <math.h> 15 #include <math.h>
16 16
17 #include <algorithm> 17 #include <algorithm>
18 #include <list> 18 #include <list>
19 #include <numeric> 19 #include <numeric>
20 #include <sstream> 20 #include <sstream>
21 #include <string> 21 #include <string>
22 #include <vector> 22 #include <vector>
23 23
24 #include "webrtc/base/common.h" 24 #include "webrtc/base/common.h"
25 #include "webrtc/base/random.h"
25 #include "webrtc/base/scoped_ptr.h" 26 #include "webrtc/base/scoped_ptr.h"
26 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
27 #include "webrtc/modules/include/module_common_types.h" 28 #include "webrtc/modules/include/module_common_types.h"
28 #include "webrtc/modules/pacing/paced_sender.h" 29 #include "webrtc/modules/pacing/paced_sender.h"
29 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 30 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
30 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" 31 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
31 #include "webrtc/modules/remote_bitrate_estimator/test/packet.h" 32 #include "webrtc/modules/remote_bitrate_estimator/test/packet.h"
32 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 33 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
33 #include "webrtc/system_wrappers/include/clock.h" 34 #include "webrtc/system_wrappers/include/clock.h"
34 #include "webrtc/test/random.h"
35 35
36 namespace webrtc { 36 namespace webrtc {
37 37
38 class RtcpBandwidthObserver; 38 class RtcpBandwidthObserver;
39 39
40 namespace testing { 40 namespace testing {
41 namespace bwe { 41 namespace bwe {
42 42
43 class DelayCapHelper; 43 class DelayCapHelper;
44 44
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 class LossFilter : public PacketProcessor { 258 class LossFilter : public PacketProcessor {
259 public: 259 public:
260 LossFilter(PacketProcessorListener* listener, int flow_id); 260 LossFilter(PacketProcessorListener* listener, int flow_id);
261 LossFilter(PacketProcessorListener* listener, const FlowIds& flow_ids); 261 LossFilter(PacketProcessorListener* listener, const FlowIds& flow_ids);
262 virtual ~LossFilter() {} 262 virtual ~LossFilter() {}
263 263
264 void SetLoss(float loss_percent); 264 void SetLoss(float loss_percent);
265 virtual void RunFor(int64_t time_ms, Packets* in_out); 265 virtual void RunFor(int64_t time_ms, Packets* in_out);
266 266
267 private: 267 private:
268 test::Random random_; 268 Random random_;
269 float loss_fraction_; 269 float loss_fraction_;
270 270
271 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LossFilter); 271 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LossFilter);
272 }; 272 };
273 273
274 class DelayFilter : public PacketProcessor { 274 class DelayFilter : public PacketProcessor {
275 public: 275 public:
276 DelayFilter(PacketProcessorListener* listener, int flow_id); 276 DelayFilter(PacketProcessorListener* listener, int flow_id);
277 DelayFilter(PacketProcessorListener* listener, const FlowIds& flow_ids); 277 DelayFilter(PacketProcessorListener* listener, const FlowIds& flow_ids);
278 virtual ~DelayFilter() {} 278 virtual ~DelayFilter() {}
(...skipping 13 matching lines...) Expand all
292 JitterFilter(PacketProcessorListener* listener, int flow_id); 292 JitterFilter(PacketProcessorListener* listener, int flow_id);
293 JitterFilter(PacketProcessorListener* listener, const FlowIds& flow_ids); 293 JitterFilter(PacketProcessorListener* listener, const FlowIds& flow_ids);
294 virtual ~JitterFilter() {} 294 virtual ~JitterFilter() {}
295 295
296 void SetMaxJitter(int64_t stddev_jitter_ms); 296 void SetMaxJitter(int64_t stddev_jitter_ms);
297 virtual void RunFor(int64_t time_ms, Packets* in_out); 297 virtual void RunFor(int64_t time_ms, Packets* in_out);
298 void set_reorderdering(bool reordering) { reordering_ = reordering; } 298 void set_reorderdering(bool reordering) { reordering_ = reordering; }
299 int64_t MeanUs(); 299 int64_t MeanUs();
300 300
301 private: 301 private:
302 test::Random random_; 302 Random random_;
303 int64_t stddev_jitter_us_; 303 int64_t stddev_jitter_us_;
304 int64_t last_send_time_us_; 304 int64_t last_send_time_us_;
305 bool reordering_; // False by default. 305 bool reordering_; // False by default.
306 306
307 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(JitterFilter); 307 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(JitterFilter);
308 }; 308 };
309 309
310 // Reorders two consecutive packets with a probability of reorder_percent. 310 // Reorders two consecutive packets with a probability of reorder_percent.
311 class ReorderFilter : public PacketProcessor { 311 class ReorderFilter : public PacketProcessor {
312 public: 312 public:
313 ReorderFilter(PacketProcessorListener* listener, int flow_id); 313 ReorderFilter(PacketProcessorListener* listener, int flow_id);
314 ReorderFilter(PacketProcessorListener* listener, const FlowIds& flow_ids); 314 ReorderFilter(PacketProcessorListener* listener, const FlowIds& flow_ids);
315 virtual ~ReorderFilter() {} 315 virtual ~ReorderFilter() {}
316 316
317 void SetReorder(float reorder_percent); 317 void SetReorder(float reorder_percent);
318 virtual void RunFor(int64_t time_ms, Packets* in_out); 318 virtual void RunFor(int64_t time_ms, Packets* in_out);
319 319
320 private: 320 private:
321 test::Random random_; 321 Random random_;
322 float reorder_fraction_; 322 float reorder_fraction_;
323 323
324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ReorderFilter); 324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ReorderFilter);
325 }; 325 };
326 326
327 // Apply a bitrate choke with an infinite queue on the packet stream. 327 // Apply a bitrate choke with an infinite queue on the packet stream.
328 class ChokeFilter : public PacketProcessor { 328 class ChokeFilter : public PacketProcessor {
329 public: 329 public:
330 ChokeFilter(PacketProcessorListener* listener, int flow_id); 330 ChokeFilter(PacketProcessorListener* listener, int flow_id);
331 ChokeFilter(PacketProcessorListener* listener, const FlowIds& flow_ids); 331 ChokeFilter(PacketProcessorListener* listener, const FlowIds& flow_ids);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 uint32_t frame_counter_; 459 uint32_t frame_counter_;
460 int compensation_bytes_; 460 int compensation_bytes_;
461 int compensation_per_frame_; 461 int compensation_per_frame_;
462 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PeriodicKeyFrameSource); 462 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PeriodicKeyFrameSource);
463 }; 463 };
464 } // namespace bwe 464 } // namespace bwe
465 } // namespace testing 465 } // namespace testing
466 } // namespace webrtc 466 } // namespace webrtc
467 467
468 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_ 468 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698