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

Side by Side Diff: webrtc/video/rampup_tests.cc

Issue 1378303004: Avoid race in RampUpTest (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ssrcs_(GenerateSsrcs(num_streams, 100)), 61 ssrcs_(GenerateSsrcs(num_streams, 100)),
62 rtx_ssrcs_(GenerateSsrcs(num_streams, 200)), 62 rtx_ssrcs_(GenerateSsrcs(num_streams, 200)),
63 poller_thread_(ThreadWrapper::CreateThread(&BitrateStatsPollingThread, 63 poller_thread_(ThreadWrapper::CreateThread(&BitrateStatsPollingThread,
64 this, 64 this,
65 "BitrateStatsPollingThread")), 65 "BitrateStatsPollingThread")),
66 sender_call_(nullptr) { 66 sender_call_(nullptr) {
67 if (rtx_) { 67 if (rtx_) {
68 for (size_t i = 0; i < ssrcs_.size(); ++i) 68 for (size_t i = 0; i < ssrcs_.size(); ++i)
69 rtx_ssrc_map_[rtx_ssrcs_[i]] = ssrcs_[i]; 69 rtx_ssrc_map_[rtx_ssrcs_[i]] = ssrcs_[i];
70 } 70 }
71 poller_thread_->Start();
72 } 71 }
73 72
74 RampUpTester::~RampUpTester() { 73 RampUpTester::~RampUpTester() {
75 event_.Set(); 74 event_.Set();
76 poller_thread_->Stop();
77 } 75 }
78 76
79 Call::Config RampUpTester::GetSenderCallConfig() { 77 Call::Config RampUpTester::GetSenderCallConfig() {
80 Call::Config call_config; 78 Call::Config call_config;
81 if (start_bitrate_bps_ != 0) { 79 if (start_bitrate_bps_ != 0) {
82 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_; 80 call_config.bitrate_config.start_bitrate_bps = start_bitrate_bps_;
83 } 81 }
84 call_config.bitrate_config.min_bitrate_bps = 10000; 82 call_config.bitrate_config.min_bitrate_bps = 10000;
85 return call_config; 83 return call_config;
86 } 84 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes"); 255 ReportResult("ramp-up-rtx-total-sent", rtx_total_sent, "bytes");
258 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes"); 256 ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
259 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes"); 257 ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
260 if (ramp_up_finished_ms_ >= 0) { 258 if (ramp_up_finished_ms_ >= 0) {
261 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_, 259 ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
262 "milliseconds"); 260 "milliseconds");
263 } 261 }
264 } 262 }
265 263
266 void RampUpTester::PerformTest() { 264 void RampUpTester::PerformTest() {
265 poller_thread_->Start();
267 if (Wait() != kEventSignaled) { 266 if (Wait() != kEventSignaled) {
268 printf("Timed out while waiting for ramp-up to complete."); 267 printf("Timed out while waiting for ramp-up to complete.");
269 return; 268 return;
270 } 269 }
271 TriggerTestDone(); 270 TriggerTestDone();
271 poller_thread_->Stop();
272 } 272 }
273 273
274 RampUpDownUpTester::RampUpDownUpTester(size_t num_streams, 274 RampUpDownUpTester::RampUpDownUpTester(size_t num_streams,
275 unsigned int start_bitrate_bps, 275 unsigned int start_bitrate_bps,
276 const std::string& extension_type, 276 const std::string& extension_type,
277 bool rtx, 277 bool rtx,
278 bool red) 278 bool red)
279 : RampUpTester(num_streams, start_bitrate_bps, extension_type, rtx, red), 279 : RampUpTester(num_streams, start_bitrate_bps, extension_type, rtx, red),
280 test_state_(kFirstRampup), 280 test_state_(kFirstRampup),
281 state_start_ms_(clock_->TimeInMilliseconds()), 281 state_start_ms_(clock_->TimeInMilliseconds()),
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, true); 491 RampUpTester test(3, 0, RtpExtension::kTransportSequenceNumber, true, true);
492 RunBaseTest(&test); 492 RunBaseTest(&test);
493 } 493 }
494 494
495 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) { 495 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
496 RampUpTester test(1, 0.9 * kSingleStreamTargetBps, 496 RampUpTester test(1, 0.9 * kSingleStreamTargetBps,
497 RtpExtension::kTransportSequenceNumber, false, false); 497 RtpExtension::kTransportSequenceNumber, false, false);
498 RunBaseTest(&test); 498 RunBaseTest(&test);
499 } 499 }
500 } // namespace webrtc 500 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698