Chromium Code Reviews| Index: webrtc/video/stats_counter.h |
| diff --git a/webrtc/video/stats_counter.h b/webrtc/video/stats_counter.h |
| index 6dc94b4328d2deecaaaaac7e6feedab5682169be..523fad20c653551bd1036d19cd974d28bf4f3963 100644 |
| --- a/webrtc/video/stats_counter.h |
| +++ b/webrtc/video/stats_counter.h |
| @@ -99,6 +99,13 @@ class StatsCounter { |
| // (i.e. empty intervals will be discarded until next sample is added). |
| void ProcessAndPause(); |
| + // As above with a minimum pause time. Added samples within this interval will |
| + // not pause the stats. |
| + void ProcessAndPauseWithMin(int64_t min_pause_time_ms); |
| + |
| + // Reports metrics for elapsed intervals to AggregatedCounter and stops pause. |
| + void ProcessAndStopPause(); |
| + |
| // Checks if a sample has been added (i.e. Add or Set called). |
| bool HasSample() const; |
| @@ -109,7 +116,8 @@ class StatsCounter { |
| StatsCounterObserver* observer); |
| void Add(int sample); |
| - void Set(int sample, uint32_t stream_id); |
| + void Set(int64_t sample, uint32_t stream_id); |
| + void SetLast(int64_t sample, uint32_t stream_id); |
| const bool include_empty_intervals_; |
| const int64_t process_intervals_ms_; |
| @@ -121,11 +129,15 @@ class StatsCounter { |
| void TryProcess(); |
| void ReportMetricToAggregatedCounter(int value, int num_values_to_add) const; |
| bool IncludeEmptyIntervals() const; |
| + void ResetPause(); |
| + void ResetPauseIfMinTimePassed(); |
| Clock* const clock_; |
| const std::unique_ptr<StatsCounterObserver> observer_; |
| int64_t last_process_time_ms_; |
| bool paused_; |
| + int64_t pause_time_ms_; |
| + int64_t min_pause_time_ms_; |
| }; |
| // AvgCounter: average of samples |
| @@ -248,9 +260,9 @@ class RateCounter : public StatsCounter { |
| // RateAccCounter: units per second (used for counters) |
| // |
| // | * * * | * * | ... |
| -// | Set(5) Set(6) Set(8) | Set(11) Set(13) | |
| +// SetLast(0)| Set(5) Set(6) Set(8) | Set(11) Set(13) | |
| // |<------ 2 sec ------->| | |
| -// GetMetric | 8 / 2 | (13 - 8) / 2 | |
| +// GetMetric | (8 - 0) / 2 | (13 - 8) / 2 | |
| // |
| // |include_empty_intervals|: If set, intervals without samples will be included |
| // in the stats. The value for an interval is |
| @@ -263,7 +275,10 @@ class RateAccCounter : public StatsCounter { |
| bool include_empty_intervals); |
| ~RateAccCounter() override {} |
| - void Set(int sample, uint32_t stream_id); |
| + void Set(int64_t sample, uint32_t stream_id); |
| + |
| + // Sets the value for previous interval. Used initially, zero is default. |
|
stefan-webrtc
2017/01/10 09:16:23
I think it would have been good with an example of
åsapersson
2017/01/13 13:02:57
Updated comment, hopefully more clear now.
|
| + void SetLast(int64_t sample, uint32_t stream_id); |
| private: |
| bool GetMetric(int* metric) const override; |