| OLD | NEW |
| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Both thresholds are inclusive, i.e. measurement >= high signifies a high | 22 // Both thresholds are inclusive, i.e. measurement >= high signifies a high |
| 23 // state, while measurement <= low signifies a low state. | 23 // state, while measurement <= low signifies a low state. |
| 24 QualityThreshold(int low_threshold, | 24 QualityThreshold(int low_threshold, |
| 25 int high_threshold, | 25 int high_threshold, |
| 26 float fraction, | 26 float fraction, |
| 27 int max_measurements); | 27 int max_measurements); |
| 28 | 28 |
| 29 void AddMeasurement(int measurement); | 29 void AddMeasurement(int measurement); |
| 30 rtc::Optional<bool> IsHigh() const; | 30 rtc::Optional<bool> IsHigh() const; |
| 31 rtc::Optional<double> CalculateVariance() const; | 31 rtc::Optional<double> CalculateVariance() const; |
| 32 rtc::Optional<double> FractionHigh(int min_required_samples) const; |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 const std::unique_ptr<int[]> buffer_; | 35 const std::unique_ptr<int[]> buffer_; |
| 35 const int max_measurements_; | 36 const int max_measurements_; |
| 36 const float fraction_; | 37 const float fraction_; |
| 37 const int low_threshold_; | 38 const int low_threshold_; |
| 38 const int high_threshold_; | 39 const int high_threshold_; |
| 39 int until_full_; | 40 int until_full_; |
| 40 int next_index_; | 41 int next_index_; |
| 41 rtc::Optional<bool> is_high_; | 42 rtc::Optional<bool> is_high_; |
| 42 int sum_; | 43 int sum_; |
| 43 int count_low_; | 44 int count_low_; |
| 44 int count_high_; | 45 int count_high_; |
| 46 int num_high_states_; |
| 47 int num_certain_states_; |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 } // namespace webrtc | 50 } // namespace webrtc |
| 48 | 51 |
| 49 #endif // WEBRTC_VIDEO_QUALITY_THRESHOLD_H_ | 52 #endif // WEBRTC_VIDEO_QUALITY_THRESHOLD_H_ |
| OLD | NEW |