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

Side by Side Diff: webrtc/modules/pacing/alr_detector.cc

Issue 2994623002: Add an experiment for stricter pacing and ALR probing. (Closed)
Patch Set: Comments addressed. Created 3 years, 4 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/modules/pacing/alr_detector.h ('k') | webrtc/video/video_send_stream.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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 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
11 #include "webrtc/modules/pacing/alr_detector.h" 11 #include "webrtc/modules/pacing/alr_detector.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "webrtc/rtc_base/checks.h" 15 #include "webrtc/rtc_base/checks.h"
16 #include "webrtc/rtc_base/format_macros.h" 16 #include "webrtc/rtc_base/format_macros.h"
17 #include "webrtc/rtc_base/logging.h" 17 #include "webrtc/rtc_base/logging.h"
18 #include "webrtc/rtc_base/timeutils.h" 18 #include "webrtc/rtc_base/timeutils.h"
19 #include "webrtc/system_wrappers/include/field_trial.h" 19 #include "webrtc/system_wrappers/include/field_trial.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 const char* AlrDetector::kScreenshareProbingBweExperimentName = 23 const char* AlrDetector::kScreenshareProbingBweExperimentName =
24 "WebRTC-ProbingScreenshareBwe"; 24 "WebRTC-ProbingScreenshareBwe";
25 const char* AlrDetector::kStrictPacingAndProbingExperimentName =
26 "WebRTC-StrictPacingAndProbing";
25 27
26 AlrDetector::AlrDetector() 28 AlrDetector::AlrDetector()
27 : bandwidth_usage_percent_(kDefaultAlrBandwidthUsagePercent), 29 : bandwidth_usage_percent_(kDefaultAlrBandwidthUsagePercent),
28 alr_start_budget_level_percent_(kDefaultAlrStartBudgetLevelPercent), 30 alr_start_budget_level_percent_(kDefaultAlrStartBudgetLevelPercent),
29 alr_stop_budget_level_percent_(kDefaultAlrStopBudgetLevelPercent), 31 alr_stop_budget_level_percent_(kDefaultAlrStopBudgetLevelPercent),
30 alr_budget_(0, true) { 32 alr_budget_(0, true) {
33 RTC_CHECK(
34 field_trial::FindFullName(kStrictPacingAndProbingExperimentName)
35 .empty() ||
36 field_trial::FindFullName(kScreenshareProbingBweExperimentName).empty());
31 rtc::Optional<AlrExperimentSettings> experiment_settings = 37 rtc::Optional<AlrExperimentSettings> experiment_settings =
32 ParseAlrSettingsFromFieldTrial(); 38 ParseAlrSettingsFromFieldTrial(kScreenshareProbingBweExperimentName);
39 if (!experiment_settings) {
40 experiment_settings =
41 ParseAlrSettingsFromFieldTrial(kStrictPacingAndProbingExperimentName);
42 }
33 if (experiment_settings) { 43 if (experiment_settings) {
34 alr_stop_budget_level_percent_ = 44 alr_stop_budget_level_percent_ =
35 experiment_settings->alr_stop_budget_level_percent; 45 experiment_settings->alr_stop_budget_level_percent;
36 alr_start_budget_level_percent_ = 46 alr_start_budget_level_percent_ =
37 experiment_settings->alr_start_budget_level_percent; 47 experiment_settings->alr_start_budget_level_percent;
38 bandwidth_usage_percent_ = experiment_settings->alr_bandwidth_usage_percent; 48 bandwidth_usage_percent_ = experiment_settings->alr_bandwidth_usage_percent;
39 } 49 }
40 } 50 }
41 51
42 AlrDetector::~AlrDetector() {} 52 AlrDetector::~AlrDetector() {}
(...skipping 17 matching lines...) Expand all
60 alr_budget_.set_target_rate_kbps(bitrate_bps * bandwidth_usage_percent_ / 70 alr_budget_.set_target_rate_kbps(bitrate_bps * bandwidth_usage_percent_ /
61 (1000 * 100)); 71 (1000 * 100));
62 } 72 }
63 73
64 rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime() 74 rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
65 const { 75 const {
66 return alr_started_time_ms_; 76 return alr_started_time_ms_;
67 } 77 }
68 78
69 rtc::Optional<AlrDetector::AlrExperimentSettings> 79 rtc::Optional<AlrDetector::AlrExperimentSettings>
70 AlrDetector::ParseAlrSettingsFromFieldTrial() { 80 AlrDetector::ParseAlrSettingsFromFieldTrial(const char* experiment_name) {
71 rtc::Optional<AlrExperimentSettings> ret; 81 rtc::Optional<AlrExperimentSettings> ret;
72 std::string group_name = 82 std::string group_name = field_trial::FindFullName(experiment_name);
73 field_trial::FindFullName(kScreenshareProbingBweExperimentName);
74 83
75 const std::string kIgnoredSuffix = "_Dogfood"; 84 const std::string kIgnoredSuffix = "_Dogfood";
76 if (group_name.rfind(kIgnoredSuffix) == 85 if (group_name.rfind(kIgnoredSuffix) ==
77 group_name.length() - kIgnoredSuffix.length()) { 86 group_name.length() - kIgnoredSuffix.length()) {
78 group_name.resize(group_name.length() - kIgnoredSuffix.length()); 87 group_name.resize(group_name.length() - kIgnoredSuffix.length());
79 } 88 }
80 89
81 if (group_name.empty()) 90 if (group_name.empty())
82 return ret; 91 return ret;
83 92
84 AlrExperimentSettings settings; 93 AlrExperimentSettings settings;
85 if (sscanf(group_name.c_str(), "%f,%" PRId64 ",%d,%d,%d", 94 if (sscanf(group_name.c_str(), "%f,%" PRId64 ",%d,%d,%d",
86 &settings.pacing_factor, &settings.max_paced_queue_time, 95 &settings.pacing_factor, &settings.max_paced_queue_time,
87 &settings.alr_bandwidth_usage_percent, 96 &settings.alr_bandwidth_usage_percent,
88 &settings.alr_start_budget_level_percent, 97 &settings.alr_start_budget_level_percent,
89 &settings.alr_stop_budget_level_percent) == 5) { 98 &settings.alr_stop_budget_level_percent) == 5) {
90 ret.emplace(settings); 99 ret.emplace(settings);
91 LOG(LS_INFO) << "Using screenshare ALR experiment settings: " 100 LOG(LS_INFO) << "Using ALR experiment settings: "
92 "pacing factor: " 101 "pacing factor: "
93 << settings.pacing_factor << ", max pacer queue length: " 102 << settings.pacing_factor << ", max pacer queue length: "
94 << settings.max_paced_queue_time 103 << settings.max_paced_queue_time
95 << ", ALR start bandwidth usage percent: " 104 << ", ALR start bandwidth usage percent: "
96 << settings.alr_bandwidth_usage_percent 105 << settings.alr_bandwidth_usage_percent
97 << ", ALR end budget level percent: " 106 << ", ALR end budget level percent: "
98 << settings.alr_start_budget_level_percent 107 << settings.alr_start_budget_level_percent
99 << ", ALR end budget level percent: " 108 << ", ALR end budget level percent: "
100 << settings.alr_stop_budget_level_percent; 109 << settings.alr_stop_budget_level_percent;
110 } else {
111 LOG(LS_INFO) << "Failed to parse ALR experiment: " << experiment_name;
101 } 112 }
102 113
103 return ret; 114 return ret;
104 } 115 }
105 116
106 } // namespace webrtc 117 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/alr_detector.h ('k') | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698