Chromium Code Reviews| Index: webrtc/video/receive_statistics_proxy.h |
| diff --git a/webrtc/video/receive_statistics_proxy.h b/webrtc/video/receive_statistics_proxy.h |
| index df763ad91073c98a0de74a144a9a9ed70de74eb3..e418e2c84af31c4dfd3f020732a274f1439ea022 100644 |
| --- a/webrtc/video/receive_statistics_proxy.h |
| +++ b/webrtc/video/receive_statistics_proxy.h |
| @@ -14,6 +14,7 @@ |
| #include <string> |
| #include "webrtc/base/criticalsection.h" |
| +#include "webrtc/base/ratetracker.h" |
| #include "webrtc/base/thread_annotations.h" |
| #include "webrtc/common_types.h" |
| #include "webrtc/frame_callback.h" |
| @@ -42,9 +43,9 @@ class ReceiveStatisticsProxy : public ViEDecoderObserver, |
| VideoReceiveStream::Stats GetStats() const; |
| void OnDecodedFrame(); |
| - void OnRenderedFrame(); |
| + void OnRenderedFrame(int width, int height); |
| - // Overrides VCMReceiveStatisticsCallback |
| + // Overrides VCMReceiveStatisticsCallback. |
| void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; |
| void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; |
| void OnDiscardedPacketsUpdated(int discarded_packets) override; |
| @@ -68,7 +69,7 @@ class ReceiveStatisticsProxy : public ViEDecoderObserver, |
| uint32_t ssrc) override; |
| void CNameChanged(const char* cname, uint32_t ssrc) override; |
| - // Overrides RtcpPacketTypeCounterObserver |
| + // Overrides RtcpPacketTypeCounterObserver. |
| void RtcpPacketTypesCounterUpdated( |
| uint32_t ssrc, |
| const RtcpPacketTypeCounter& packet_counter) override; |
| @@ -77,13 +78,31 @@ class ReceiveStatisticsProxy : public ViEDecoderObserver, |
| uint32_t ssrc) override; |
| private: |
| - void UpdateHistograms() const; |
| + struct SampleCounter { |
| + SampleCounter() : sum(0), num(0) {} |
| + void Add(int sample) { |
|
pbos-webrtc
2015/07/20 13:52:22
Move implementation-parts to .cc file.
åsapersson
2015/07/20 15:06:30
Done.
|
| + sum += sample; |
| + ++num; |
| + } |
| + int Avg(int min_required_samples) const { |
| + if (num < min_required_samples || num == 0) return -1; |
| + return sum / num; |
| + } |
| + private: |
|
pbos-webrtc
2015/07/20 13:52:22
run git cl format
åsapersson
2015/07/20 15:06:30
Done.
|
| + int sum; |
| + int num; |
|
pbos-webrtc
2015/07/20 15:11:07
rename num -> num_samples
åsapersson
2015/07/21 06:05:46
Done.
|
| + }; |
| + |
| + void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| Clock* const clock_; |
|
pbos-webrtc
2015/07/20 13:52:22
newline before, consider moving clock_ down to the
åsapersson
2015/07/20 15:06:30
Done.
|
| mutable rtc::CriticalSection crit_; |
| VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); |
| RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); |
| RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); |
| + rtc::RateTracker render_fps_tracker_total_ GUARDED_BY(crit_); |
| + SampleCounter render_width_counter_ GUARDED_BY(crit_); |
| + SampleCounter render_height_counter_ GUARDED_BY(crit_); |
| ReportBlockStats report_block_stats_ GUARDED_BY(crit_); |
| }; |