OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 | 11 |
12 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H _ | 12 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H _ |
13 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H _ | 13 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H _ |
14 | 14 |
15 #include <cstdint> | 15 #include <cstdint> |
16 #include <limits> | 16 #include <limits> |
17 | 17 |
18 #include "webrtc/rtc_base/optional.h" | 18 #include "webrtc/rtc_base/optional.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 namespace testing { | 21 namespace testing { |
22 namespace bwe { | 22 namespace bwe { |
23 class MinRttFilter { | 23 class MinRttFilter { |
24 public: | 24 public: |
25 MinRttFilter() {} | 25 MinRttFilter() {} |
26 ~MinRttFilter() {} | 26 ~MinRttFilter() {} |
27 | 27 |
28 rtc::Optional<int64_t> min_rtt_ms() { return min_rtt_ms_; } | 28 rtc::Optional<int64_t> min_rtt_ms() { return min_rtt_ms_; } |
29 void add_rtt_sample(int64_t rtt_ms, int64_t now_ms) { | 29 void add_rtt_sample(int64_t rtt_ms, int64_t now_ms, bool min_rtt_expired) { |
philipel
2017/08/04 12:08:08
AddRttSample
Also, it should not take |min_rtt_ex
gnish1
2017/08/07 10:34:29
Done.
| |
30 if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_) { | 30 if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_ || min_rtt_expired) { |
31 min_rtt_ms_.emplace(rtt_ms); | 31 min_rtt_ms_.emplace(rtt_ms); |
32 discovery_time_ms_ = now_ms; | 32 discovery_time_ms_ = now_ms; |
33 } | 33 } |
34 } | 34 } |
35 int64_t discovery_time() { return discovery_time_ms_; } | 35 int64_t discovery_time() { return discovery_time_ms_; } |
36 | 36 |
37 // Checks whether or not last discovered min_rtt value is older than x | 37 // Checks whether or not last discovered min_rtt value is older than x |
38 // milliseconds. | 38 // milliseconds. |
39 bool min_rtt_expired(int64_t now_ms, int64_t min_rtt_filter_window_size_ms) { | 39 bool min_rtt_expired(int64_t now_ms, int64_t min_rtt_filter_window_size_ms) { |
philipel
2017/08/04 12:08:08
MinRttExpired.
gnish1
2017/08/07 10:34:29
Done.
| |
40 return now_ms - discovery_time_ms_ >= min_rtt_filter_window_size_ms; | 40 return now_ms - discovery_time_ms_ >= min_rtt_filter_window_size_ms; |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 rtc::Optional<int64_t> min_rtt_ms_; | 44 rtc::Optional<int64_t> min_rtt_ms_; |
45 int64_t discovery_time_ms_ = 0; | 45 int64_t discovery_time_ms_ = 0; |
46 }; | 46 }; |
47 } // namespace bwe | 47 } // namespace bwe |
48 } // namespace testing | 48 } // namespace testing |
49 } // namespace webrtc | 49 } // namespace webrtc |
50 | 50 |
51 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTE R_H_ | 51 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTE R_H_ |
OLD | NEW |