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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc

Issue 1750533002: Replace scoped_ptr with unique_ptr in webrtc/modules/remote_bitrate_estimator/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 | webrtc/modules/remote_bitrate_estimator/inter_arrival_unittest.cc » ('j') | 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 <memory>
12
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 #include "webrtc/base/scoped_ptr.h"
13 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 14 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
14 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" 15 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h"
15 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" 16 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h"
16 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" 17 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
17 #include "webrtc/test/testsupport/fileutils.h" 18 #include "webrtc/test/testsupport/fileutils.h"
18 19
19 20
20 namespace webrtc { 21 namespace webrtc {
21 namespace testing { 22 namespace testing {
22 namespace bwe { 23 namespace bwe {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]); 238 RateCounterFilter counter2(&uplink_, 0, "Receiver", bwe_names[GetParam()]);
238 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); 239 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true);
239 ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx"))); 240 ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx")));
240 RunFor(300 * 1000); 241 RunFor(300 * 1000);
241 } 242 }
242 243
243 TEST_P(BweSimulation, SelfFairnessTest) { 244 TEST_P(BweSimulation, SelfFairnessTest) {
244 Random prng(Clock::GetRealTimeClock()->TimeInMicroseconds()); 245 Random prng(Clock::GetRealTimeClock()->TimeInMicroseconds());
245 const int kAllFlowIds[] = {0, 1, 2, 3}; 246 const int kAllFlowIds[] = {0, 1, 2, 3};
246 const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]); 247 const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]);
247 rtc::scoped_ptr<VideoSource> sources[kNumFlows]; 248 std::unique_ptr<VideoSource> sources[kNumFlows];
248 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; 249 std::unique_ptr<VideoSender> senders[kNumFlows];
249 for (size_t i = 0; i < kNumFlows; ++i) { 250 for (size_t i = 0; i < kNumFlows; ++i) {
250 // Streams started 20 seconds apart to give them different advantage when 251 // Streams started 20 seconds apart to give them different advantage when
251 // competing for the bandwidth. 252 // competing for the bandwidth.
252 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, 253 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0,
253 i * prng.Rand(39999))); 254 i * prng.Rand(39999)));
254 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam())); 255 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam()));
255 } 256 }
256 257
257 ChokeFilter choke(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); 258 ChokeFilter choke(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows));
258 choke.set_capacity_kbps(1000); 259 choke.set_capacity_kbps(1000);
259 260
260 rtc::scoped_ptr<RateCounterFilter> rate_counters[kNumFlows]; 261 std::unique_ptr<RateCounterFilter> rate_counters[kNumFlows];
261 for (size_t i = 0; i < kNumFlows; ++i) { 262 for (size_t i = 0; i < kNumFlows; ++i) {
262 rate_counters[i].reset( 263 rate_counters[i].reset(
263 new RateCounterFilter(&uplink_, CreateFlowIds(&kAllFlowIds[i], 1), 264 new RateCounterFilter(&uplink_, CreateFlowIds(&kAllFlowIds[i], 1),
264 "Receiver", bwe_names[GetParam()])); 265 "Receiver", bwe_names[GetParam()]));
265 } 266 }
266 267
267 RateCounterFilter total_utilization( 268 RateCounterFilter total_utilization(
268 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization", 269 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization",
269 "Total_link_utilization"); 270 "Total_link_utilization");
270 271
271 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; 272 std::unique_ptr<PacketReceiver> receivers[kNumFlows];
272 for (size_t i = 0; i < kNumFlows; ++i) { 273 for (size_t i = 0; i < kNumFlows; ++i) {
273 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(), 274 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(),
274 i == 0, false)); 275 i == 0, false));
275 } 276 }
276 277
277 RunFor(30 * 60 * 1000); 278 RunFor(30 * 60 * 1000);
278 } 279 }
279 280
280 TEST_P(BweSimulation, PacedSelfFairness50msTest) { 281 TEST_P(BweSimulation, PacedSelfFairness50msTest) {
281 const int64_t kAverageOffsetMs = 20 * 1000; 282 const int64_t kAverageOffsetMs = 20 * 1000;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 442
442 BweTest gcc_test(false); 443 BweTest gcc_test(false);
443 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps); 444 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
444 } 445 }
445 446
446 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 447 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
447 } // namespace bwe 448 } // namespace bwe
448 } // namespace testing 449 } // namespace testing
449 } // namespace webrtc 450 } // namespace webrtc
450 451
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/inter_arrival_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698