Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 class OveruseDetector { | 23 class OveruseDetector { |
| 24 public: | 24 public: |
| 25 explicit OveruseDetector(const OverUseDetectorOptions& options); | 25 explicit OveruseDetector(const OverUseDetectorOptions& options); |
| 26 ~OveruseDetector(); | 26 virtual ~OveruseDetector(); |
| 27 | 27 |
| 28 // Update the detection state based on the estimated inter-arrival time delta | 28 // 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 | 29 // 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 | 30 // estimated offset is based on and the last timestamp on which the last |
| 31 // offset was based on, representing the time between detector updates. | 31 // 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. | 32 // |num_of_deltas| is the number of deltas the offset estimate is based on. |
| 33 // Returns the state after the detection update. | 33 // Returns the state after the detection update. |
| 34 BandwidthUsage Detect(double offset, | 34 BandwidthUsage Detect(double offset, |
| 35 double timestamp_delta, | 35 double timestamp_delta, |
| 36 int num_of_deltas, | 36 int num_of_deltas, |
| 37 int64_t now_ms); | 37 int64_t now_ms, |
| 38 int incoming_bitrate); | |
| 38 | 39 |
| 39 // Returns the current detector state. | 40 // Returns the current detector state. |
| 40 BandwidthUsage State() const; | 41 BandwidthUsage State() const; |
| 41 | 42 |
| 42 // Sets the current rate-control region as decided by RemoteRateControl. This | 43 virtual bool AdaptiveThresholdExperimentIsEnabled() const; |
| 43 // affects the sensitivity of the detector. | 44 virtual bool ExperimentVariationIsEnabled(const char* variation) const; |
| 44 void SetRateControlRegion(webrtc::RateControlRegion region); | |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void UpdateThreshold(double modified_offset, | |
| 48 int64_t now_ms, | |
| 49 int incoming_bitrate); | |
|
Gaetano Carlucci
2015/06/25 11:58:36
we can remove the input incoming_bitrate
stefan-webrtc
2015/06/25 12:37:13
Done.
| |
| 50 bool GetExperimentThresholds(double* k_up, double* k_down) const; | |
| 51 | |
| 47 // Must be first member variable. Cannot be const because we need to be | 52 // Must be first member variable. Cannot be const because we need to be |
| 48 // copyable. | 53 // copyable. |
| 49 webrtc::OverUseDetectorOptions options_; | 54 webrtc::OverUseDetectorOptions options_; |
| 50 double threshold_; | 55 double threshold_; |
| 56 int64_t last_update_ms_; | |
| 51 double prev_offset_; | 57 double prev_offset_; |
| 52 double time_over_using_; | 58 double time_over_using_; |
| 53 int overuse_counter_; | 59 int overuse_counter_; |
| 54 BandwidthUsage hypothesis_; | 60 BandwidthUsage hypothesis_; |
| 61 double k_up_; | |
| 62 double k_down_; | |
| 55 | 63 |
| 56 DISALLOW_COPY_AND_ASSIGN(OveruseDetector); | 64 DISALLOW_COPY_AND_ASSIGN(OveruseDetector); |
| 57 }; | 65 }; |
| 58 } // namespace webrtc | 66 } // namespace webrtc |
| 59 | 67 |
| 60 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ | 68 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ |
| OLD | NEW |