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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Note: StatsCounter takes ownership of |observer|. | 75 // Note: StatsCounter takes ownership of |observer|. |
76 | 76 |
77 class StatsCounter { | 77 class StatsCounter { |
78 public: | 78 public: |
79 virtual ~StatsCounter(); | 79 virtual ~StatsCounter(); |
80 | 80 |
81 virtual bool GetMetric(int* metric) const = 0; | 81 virtual bool GetMetric(int* metric) const = 0; |
82 | 82 |
83 AggregatedStats GetStats(); | 83 AggregatedStats GetStats(); |
84 | 84 |
| 85 // Checks if a sample has been added (i.e. Add or Set called). |
| 86 bool HasSample() const; |
| 87 |
85 protected: | 88 protected: |
86 StatsCounter(Clock* clock, | 89 StatsCounter(Clock* clock, |
87 bool include_empty_intervals, | 90 bool include_empty_intervals, |
88 StatsCounterObserver* observer); | 91 StatsCounterObserver* observer); |
89 | 92 |
90 void Add(int sample); | 93 void Add(int sample); |
91 void Set(int sample); | 94 void Set(int sample); |
92 | 95 |
93 int max_; | 96 int max_; |
94 int64_t sum_; | 97 int64_t sum_; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 225 |
223 private: | 226 private: |
224 bool GetMetric(int* metric) const override; | 227 bool GetMetric(int* metric) const override; |
225 | 228 |
226 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); | 229 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); |
227 }; | 230 }; |
228 | 231 |
229 } // namespace webrtc | 232 } // namespace webrtc |
230 | 233 |
231 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ | 234 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ |
OLD | NEW |