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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/overuse_detector.h

Issue 1151603008: Make the BWE threshold adaptive. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Redid the experiment settings initialization slightly and set the default threshold back to 12.5. Created 5 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ 10 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
11 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ 11 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
12 12
13 #include <list> 13 #include <list>
14 14
15 #include "webrtc/base/constructormagic.h" 15 #include "webrtc/base/constructormagic.h"
16 #include "webrtc/modules/interface/module_common_types.h" 16 #include "webrtc/modules/interface/module_common_types.h"
17 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" 17 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
18 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 enum RateControlRegion; 21 enum RateControlRegion;
22 22
23 bool AdaptiveThresholdExperimentIsEnabled();
24
23 class OveruseDetector { 25 class OveruseDetector {
24 public: 26 public:
25 explicit OveruseDetector(const OverUseDetectorOptions& options); 27 explicit OveruseDetector(const OverUseDetectorOptions& options);
26 ~OveruseDetector(); 28 virtual ~OveruseDetector();
27 29
28 // Update the detection state based on the estimated inter-arrival time delta 30 // Update the detection state based on the estimated inter-arrival time delta
29 // offset. |timestamp_delta| is the delta between the last timestamp which the 31 // offset. |timestamp_delta| is the delta between the last timestamp which the
30 // estimated offset is based on and the last timestamp on which the last 32 // estimated offset is based on and the last timestamp on which the last
31 // offset was based on, representing the time between detector updates. 33 // offset was based on, representing the time between detector updates.
32 // |num_of_deltas| is the number of deltas the offset estimate is based on. 34 // |num_of_deltas| is the number of deltas the offset estimate is based on.
33 // Returns the state after the detection update. 35 // Returns the state after the detection update.
34 BandwidthUsage Detect(double offset, 36 BandwidthUsage Detect(double offset,
35 double timestamp_delta, 37 double timestamp_delta,
36 int num_of_deltas, 38 int num_of_deltas,
37 int64_t now_ms); 39 int64_t now_ms);
38 40
39 // Returns the current detector state. 41 // Returns the current detector state.
40 BandwidthUsage State() const; 42 BandwidthUsage State() const;
41 43
42 // Sets the current rate-control region as decided by RemoteRateControl. This 44 virtual void InitializeExperiment();
pbos-webrtc 2015/07/06 10:01:40 Don't like this being virtual, pref. checking in_e
stefan-webrtc 2015/07/06 10:54:26 Done.
pbos-webrtc 2015/07/06 11:13:26 This is still virtual, does it even have to be ext
stefan-webrtc 2015/07/06 12:16:13 Done.
43 // affects the sensitivity of the detector. 45
44 void SetRateControlRegion(webrtc::RateControlRegion region); 46 protected:
47 double threshold_;
48 double k_up_;
49 double k_down_;
50 bool experiment_set_;
51 bool in_experiment_;
45 52
46 private: 53 private:
54 void UpdateThreshold(double modified_offset, int64_t now_ms);
55 bool AdaptiveThresholdExperimentIsEnabled();
56 bool ReadExperimentConstants(double* k_up, double* k_down) const;
57
47 // Must be first member variable. Cannot be const because we need to be 58 // Must be first member variable. Cannot be const because we need to be
48 // copyable. 59 // copyable.
49 webrtc::OverUseDetectorOptions options_; 60 webrtc::OverUseDetectorOptions options_;
50 double threshold_; 61 int64_t last_update_ms_;
51 double prev_offset_; 62 double prev_offset_;
52 double time_over_using_; 63 double time_over_using_;
53 int overuse_counter_; 64 int overuse_counter_;
54 BandwidthUsage hypothesis_; 65 BandwidthUsage hypothesis_;
55 66
56 DISALLOW_COPY_AND_ASSIGN(OveruseDetector); 67 DISALLOW_COPY_AND_ASSIGN(OveruseDetector);
57 }; 68 };
58 } // namespace webrtc 69 } // namespace webrtc
59 70
60 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ 71 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698