| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // RateCounter: units per second | 185 // RateCounter: units per second |
| 186 // | 186 // |
| 187 // | * * * | * * | ... | 187 // | * * * | * * | ... |
| 188 // | Add(5) Add(1) Add(6) | Add(5) Add(5) | | 188 // | Add(5) Add(1) Add(6) | Add(5) Add(5) | |
| 189 // |<------ 2 sec ------->| | | 189 // |<------ 2 sec ------->| | |
| 190 // GetMetric | (5 + 1 + 6) / 2 | (5 + 5) / 2 | | 190 // GetMetric | (5 + 1 + 6) / 2 | (5 + 5) / 2 | |
| 191 // | 191 // |
| 192 class RateCounter : public StatsCounter { | 192 class RateCounter : public StatsCounter { |
| 193 public: | 193 public: |
| 194 RateCounter(Clock* clock, StatsCounterObserver* observer); | 194 RateCounter(Clock* clock, |
| 195 StatsCounterObserver* observer, |
| 196 bool include_empty_intervals); |
| 195 ~RateCounter() override {} | 197 ~RateCounter() override {} |
| 196 | 198 |
| 197 void Add(int sample); | 199 void Add(int sample); |
| 198 | 200 |
| 199 private: | 201 private: |
| 200 bool GetMetric(int* metric) const override; | 202 bool GetMetric(int* metric) const override; |
| 201 | 203 |
| 202 RTC_DISALLOW_COPY_AND_ASSIGN(RateCounter); | 204 RTC_DISALLOW_COPY_AND_ASSIGN(RateCounter); |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 // RateAccCounter: units per second (used for counters) | 207 // RateAccCounter: units per second (used for counters) |
| 206 // | 208 // |
| 207 // | * * * | * * | ... | 209 // | * * * | * * | ... |
| 208 // | Set(5) Set(6) Set(8) | Set(11) Set(13) | | 210 // | Set(5) Set(6) Set(8) | Set(11) Set(13) | |
| 209 // |<------ 2 sec ------->| | | 211 // |<------ 2 sec ------->| | |
| 210 // GetMetric | 8 / 2 | (13 - 8) / 2 | | 212 // GetMetric | 8 / 2 | (13 - 8) / 2 | |
| 211 // | 213 // |
| 212 class RateAccCounter : public StatsCounter { | 214 class RateAccCounter : public StatsCounter { |
| 213 public: | 215 public: |
| 214 RateAccCounter(Clock* clock, StatsCounterObserver* observer); | 216 RateAccCounter(Clock* clock, |
| 217 StatsCounterObserver* observer, |
| 218 bool include_empty_intervals); |
| 215 ~RateAccCounter() override {} | 219 ~RateAccCounter() override {} |
| 216 | 220 |
| 217 void Set(int sample); | 221 void Set(int sample); |
| 218 | 222 |
| 219 private: | 223 private: |
| 220 bool GetMetric(int* metric) const override; | 224 bool GetMetric(int* metric) const override; |
| 221 | 225 |
| 222 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); | 226 RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); |
| 223 }; | 227 }; |
| 224 | 228 |
| 225 } // namespace webrtc | 229 } // namespace webrtc |
| 226 | 230 |
| 227 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ | 231 #endif // WEBRTC_VIDEO_STATS_COUNTER_H_ |
| OLD | NEW |