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

Side by Side Diff: webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc

Issue 2110113003: Reland of "Move RtcEventLog object from inside VoiceEngine to Call.", "Fix to make the start/stop f… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 5 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
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 <algorithm> 11 #include <algorithm>
12 #include <vector> 12 #include <vector>
13 13
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "webrtc/call/mock/mock_rtc_event_log.h"
15 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h" 16 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 19
19 void TestProbing(bool use_delay_based) { 20 void TestProbing(bool use_delay_based) {
20 SendSideBandwidthEstimation bwe; 21 MockRtcEventLog event_log;
22 SendSideBandwidthEstimation bwe(&event_log);
21 bwe.SetMinMaxBitrate(100000, 1500000); 23 bwe.SetMinMaxBitrate(100000, 1500000);
22 bwe.SetSendBitrate(200000); 24 bwe.SetSendBitrate(200000);
23 25
24 const int kRembBps = 1000000; 26 const int kRembBps = 1000000;
25 const int kSecondRembBps = kRembBps + 500000; 27 const int kSecondRembBps = kRembBps + 500000;
26 int64_t now_ms = 0; 28 int64_t now_ms = 0;
27 29
28 bwe.UpdateReceiverBlock(0, 50, 1, now_ms); 30 bwe.UpdateReceiverBlock(0, 50, 1, now_ms);
29 31
30 // Initial REMB applies immediately. 32 // Initial REMB applies immediately.
(...skipping 24 matching lines...) Expand all
55 57
56 TEST(SendSideBweTest, InitialRembWithProbing) { 58 TEST(SendSideBweTest, InitialRembWithProbing) {
57 TestProbing(false); 59 TestProbing(false);
58 } 60 }
59 61
60 TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) { 62 TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) {
61 TestProbing(true); 63 TestProbing(true);
62 } 64 }
63 65
64 TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) { 66 TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
65 SendSideBandwidthEstimation bwe; 67 MockRtcEventLog event_log;
68 EXPECT_CALL(event_log,
69 LogBwePacketLossEvent(testing::Gt(0), testing::Gt(0), 0))
70 .Times(3);
71 SendSideBandwidthEstimation bwe(&event_log);
66 static const int kMinBitrateBps = 100000; 72 static const int kMinBitrateBps = 100000;
67 static const int kInitialBitrateBps = 1000000; 73 static const int kInitialBitrateBps = 1000000;
68 bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000); 74 bwe.SetMinMaxBitrate(kMinBitrateBps, 1500000);
69 bwe.SetSendBitrate(kInitialBitrateBps); 75 bwe.SetSendBitrate(kInitialBitrateBps);
70 76
71 static const uint8_t kFractionLoss = 128; 77 static const uint8_t kFractionLoss = 128;
72 static const int64_t kRttMs = 50; 78 static const int64_t kRttMs = 50;
73 79
74 int64_t now_ms = 0; 80 int64_t now_ms = 0;
75 int bitrate_bps; 81 int bitrate_bps;
(...skipping 29 matching lines...) Expand all
105 bwe.UpdateEstimate(now_ms); 111 bwe.UpdateEstimate(now_ms);
106 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms); 112 bwe.CurrentEstimate(&bitrate_bps, &fraction_loss, &rtt_ms);
107 113
108 EXPECT_EQ(last_bitrate_bps, bitrate_bps); 114 EXPECT_EQ(last_bitrate_bps, bitrate_bps);
109 // The old loss rate should still be applied though. 115 // The old loss rate should still be applied though.
110 EXPECT_EQ(kFractionLoss, fraction_loss); 116 EXPECT_EQ(kFractionLoss, fraction_loss);
111 EXPECT_EQ(kRttMs, rtt_ms); 117 EXPECT_EQ(kRttMs, rtt_ms);
112 } 118 }
113 119
114 } // namespace webrtc 120 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc ('k') | webrtc/modules/congestion_controller/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698