| 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/include/module_common_types.h" | 16 #include "webrtc/modules/include/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(); | 23 bool AdaptiveThresholdExperimentIsEnabled(); |
| 24 | 24 |
| 25 class OveruseDetector { | 25 class OveruseDetector { |
| 26 public: | 26 public: |
| 27 explicit OveruseDetector(const OverUseDetectorOptions& options); | 27 OveruseDetector(); |
| 28 virtual ~OveruseDetector(); | 28 virtual ~OveruseDetector(); |
| 29 | 29 |
| 30 // 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 |
| 31 // 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 |
| 32 // 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 |
| 33 // offset was based on, representing the time between detector updates. | 33 // offset was based on, representing the time between detector updates. |
| 34 // |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. |
| 35 // Returns the state after the detection update. | 35 // Returns the state after the detection update. |
| 36 BandwidthUsage Detect(double offset, | 36 BandwidthUsage Detect(double offset, |
| 37 double timestamp_delta, | 37 double timestamp_delta, |
| 38 int num_of_deltas, | 38 int num_of_deltas, |
| 39 int64_t now_ms); | 39 int64_t now_ms); |
| 40 | 40 |
| 41 // Returns the current detector state. | 41 // Returns the current detector state. |
| 42 BandwidthUsage State() const; | 42 BandwidthUsage State() const; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 void UpdateThreshold(double modified_offset, int64_t now_ms); | 45 void UpdateThreshold(double modified_offset, int64_t now_ms); |
| 46 void InitializeExperiment(); | 46 void InitializeExperiment(); |
| 47 | 47 |
| 48 const bool in_experiment_; | 48 const bool in_experiment_; |
| 49 double k_up_; | 49 double k_up_; |
| 50 double k_down_; | 50 double k_down_; |
| 51 double overusing_time_threshold_; | 51 double overusing_time_threshold_; |
| 52 // 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 |
| 53 // copyable. | 53 // copyable. |
| 54 webrtc::OverUseDetectorOptions options_; | |
| 55 double threshold_; | 54 double threshold_; |
| 56 int64_t last_update_ms_; | 55 int64_t last_update_ms_; |
| 57 double prev_offset_; | 56 double prev_offset_; |
| 58 double time_over_using_; | 57 double time_over_using_; |
| 59 int overuse_counter_; | 58 int overuse_counter_; |
| 60 BandwidthUsage hypothesis_; | 59 BandwidthUsage hypothesis_; |
| 61 | 60 |
| 62 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseDetector); | 61 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseDetector); |
| 63 }; | 62 }; |
| 64 } // namespace webrtc | 63 } // namespace webrtc |
| 65 | 64 |
| 66 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ | 65 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_ |
| OLD | NEW |