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

Side by Side Diff: webrtc/common_video/bitrate_adjuster_unittest.cc

Issue 2029593002: Update RateStatistics to handle too-little-data case. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment Created 4 years, 6 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 | « webrtc/common_video/bitrate_adjuster.cc ('k') | webrtc/common_video/include/bitrate_adjuster.h » ('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 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 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 30 matching lines...) Expand all
41 41
42 uint32_t GetTargetBitrateBpsPct(float pct) { 42 uint32_t GetTargetBitrateBpsPct(float pct) {
43 return pct * adjuster_.GetTargetBitrateBps(); 43 return pct * adjuster_.GetTargetBitrateBps();
44 } 44 }
45 45
46 void VerifyAdjustment() { 46 void VerifyAdjustment() {
47 // The adjusted bitrate should be between the estimated bitrate and the 47 // The adjusted bitrate should be between the estimated bitrate and the
48 // target bitrate within clamp. 48 // target bitrate within clamp.
49 uint32_t target_bitrate_bps = adjuster_.GetTargetBitrateBps(); 49 uint32_t target_bitrate_bps = adjuster_.GetTargetBitrateBps();
50 uint32_t adjusted_bitrate_bps = adjuster_.GetAdjustedBitrateBps(); 50 uint32_t adjusted_bitrate_bps = adjuster_.GetAdjustedBitrateBps();
51 uint32_t estimated_bitrate_bps = adjuster_.GetEstimatedBitrateBps(); 51 uint32_t estimated_bitrate_bps =
52 adjuster_.GetEstimatedBitrateBps().value_or(target_bitrate_bps);
52 uint32_t adjusted_lower_bound_bps = 53 uint32_t adjusted_lower_bound_bps =
53 GetTargetBitrateBpsPct(kMinAdjustedBitratePct); 54 GetTargetBitrateBpsPct(kMinAdjustedBitratePct);
54 uint32_t adjusted_upper_bound_bps = 55 uint32_t adjusted_upper_bound_bps =
55 GetTargetBitrateBpsPct(kMaxAdjustedBitratePct); 56 GetTargetBitrateBpsPct(kMaxAdjustedBitratePct);
56 EXPECT_LE(adjusted_bitrate_bps, adjusted_upper_bound_bps); 57 EXPECT_LE(adjusted_bitrate_bps, adjusted_upper_bound_bps);
57 EXPECT_GE(adjusted_bitrate_bps, adjusted_lower_bound_bps); 58 EXPECT_GE(adjusted_bitrate_bps, adjusted_lower_bound_bps);
58 if (estimated_bitrate_bps > target_bitrate_bps) { 59 if (estimated_bitrate_bps > target_bitrate_bps) {
59 EXPECT_LT(adjusted_bitrate_bps, target_bitrate_bps); 60 EXPECT_LT(adjusted_bitrate_bps, target_bitrate_bps);
60 } 61 }
61 } 62 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_EQ(initial_target_bitrate_bps, adjuster_.GetAdjustedBitrateBps()); 160 EXPECT_EQ(initial_target_bitrate_bps, adjuster_.GetAdjustedBitrateBps());
160 161
161 // 1.05 * 1.05 is 1.1 which is greater than tolerance for the initial target 162 // 1.05 * 1.05 is 1.1 which is greater than tolerance for the initial target
162 // bitrate. Since we didn't advance the clock the adjuster never updated. 163 // bitrate. Since we didn't advance the clock the adjuster never updated.
163 target_bitrate_bps = (1 + delta_pct) * target_bitrate_bps; 164 target_bitrate_bps = (1 + delta_pct) * target_bitrate_bps;
164 adjuster_.SetTargetBitrateBps(target_bitrate_bps); 165 adjuster_.SetTargetBitrateBps(target_bitrate_bps);
165 EXPECT_EQ(target_bitrate_bps, adjuster_.GetAdjustedBitrateBps()); 166 EXPECT_EQ(target_bitrate_bps, adjuster_.GetAdjustedBitrateBps());
166 } 167 }
167 168
168 } // namespace webrtc 169 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/bitrate_adjuster.cc ('k') | webrtc/common_video/include/bitrate_adjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698