Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: webrtc/video/receive_statistics_proxy.h

Issue 1228393008: Add resolution and fps stats to histograms. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: added render fps Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #ifndef WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ 11 #ifndef WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
12 #define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ 12 #define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/ratetracker.h"
17 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
18 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
19 #include "webrtc/frame_callback.h" 20 #include "webrtc/frame_callback.h"
20 #include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h" 21 #include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h"
21 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" 22 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
22 #include "webrtc/video_engine/report_block_stats.h" 23 #include "webrtc/video_engine/report_block_stats.h"
23 #include "webrtc/video_engine/vie_channel.h" 24 #include "webrtc/video_engine/vie_channel.h"
24 #include "webrtc/video_receive_stream.h" 25 #include "webrtc/video_receive_stream.h"
25 #include "webrtc/video_renderer.h" 26 #include "webrtc/video_renderer.h"
26 27
27 namespace webrtc { 28 namespace webrtc {
28 29
29 class Clock; 30 class Clock;
30 class ViECodec; 31 class ViECodec;
31 class ViEDecoderObserver; 32 class ViEDecoderObserver;
32 33
33 class ReceiveStatisticsProxy : public ViEDecoderObserver, 34 class ReceiveStatisticsProxy : public ViEDecoderObserver,
34 public VCMReceiveStatisticsCallback, 35 public VCMReceiveStatisticsCallback,
35 public RtcpStatisticsCallback, 36 public RtcpStatisticsCallback,
36 public RtcpPacketTypeCounterObserver, 37 public RtcpPacketTypeCounterObserver,
37 public StreamDataCountersCallback { 38 public StreamDataCountersCallback {
38 public: 39 public:
39 ReceiveStatisticsProxy(uint32_t ssrc, Clock* clock); 40 ReceiveStatisticsProxy(uint32_t ssrc, Clock* clock);
40 virtual ~ReceiveStatisticsProxy(); 41 virtual ~ReceiveStatisticsProxy();
41 42
42 VideoReceiveStream::Stats GetStats() const; 43 VideoReceiveStream::Stats GetStats() const;
43 44
44 void OnDecodedFrame(); 45 void OnDecodedFrame();
45 void OnRenderedFrame(); 46 void OnRenderedFrame(int width, int height);
46 47
47 // Overrides VCMReceiveStatisticsCallback 48 // Overrides VCMReceiveStatisticsCallback.
48 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; 49 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override;
49 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; 50 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override;
50 void OnDiscardedPacketsUpdated(int discarded_packets) override; 51 void OnDiscardedPacketsUpdated(int discarded_packets) override;
51 52
52 // Overrides ViEDecoderObserver. 53 // Overrides ViEDecoderObserver.
53 void IncomingCodecChanged(const int video_channel, 54 void IncomingCodecChanged(const int video_channel,
54 const VideoCodec& video_codec) override {} 55 const VideoCodec& video_codec) override {}
55 void IncomingRate(const int video_channel, 56 void IncomingRate(const int video_channel,
56 const unsigned int framerate, 57 const unsigned int framerate,
57 const unsigned int bitrate_bps) override; 58 const unsigned int bitrate_bps) override;
58 void DecoderTiming(int decode_ms, 59 void DecoderTiming(int decode_ms,
59 int max_decode_ms, 60 int max_decode_ms,
60 int current_delay_ms, 61 int current_delay_ms,
61 int target_delay_ms, 62 int target_delay_ms,
62 int jitter_buffer_ms, 63 int jitter_buffer_ms,
63 int min_playout_delay_ms, 64 int min_playout_delay_ms,
64 int render_delay_ms) override; 65 int render_delay_ms) override;
65 66
66 // Overrides RtcpStatisticsCallback. 67 // Overrides RtcpStatisticsCallback.
67 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics, 68 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics,
68 uint32_t ssrc) override; 69 uint32_t ssrc) override;
69 void CNameChanged(const char* cname, uint32_t ssrc) override; 70 void CNameChanged(const char* cname, uint32_t ssrc) override;
70 71
71 // Overrides RtcpPacketTypeCounterObserver 72 // Overrides RtcpPacketTypeCounterObserver.
72 void RtcpPacketTypesCounterUpdated( 73 void RtcpPacketTypesCounterUpdated(
73 uint32_t ssrc, 74 uint32_t ssrc,
74 const RtcpPacketTypeCounter& packet_counter) override; 75 const RtcpPacketTypeCounter& packet_counter) override;
75 // Overrides StreamDataCountersCallback. 76 // Overrides StreamDataCountersCallback.
76 void DataCountersUpdated(const webrtc::StreamDataCounters& counters, 77 void DataCountersUpdated(const webrtc::StreamDataCounters& counters,
77 uint32_t ssrc) override; 78 uint32_t ssrc) override;
78 79
79 private: 80 private:
80 void UpdateHistograms() const; 81 struct SampleCounter {
82 SampleCounter() : sum(0), num(0) {}
83 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.
84 sum += sample;
85 ++num;
86 }
87 int Avg(int min_required_samples) const {
88 if (num < min_required_samples || num == 0) return -1;
89 return sum / num;
90 }
91 private:
pbos-webrtc 2015/07/20 13:52:22 run git cl format
åsapersson 2015/07/20 15:06:30 Done.
92 int sum;
93 int num;
pbos-webrtc 2015/07/20 15:11:07 rename num -> num_samples
åsapersson 2015/07/21 06:05:46 Done.
94 };
95
96 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
81 Clock* const clock_; 97 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.
82 98
83 mutable rtc::CriticalSection crit_; 99 mutable rtc::CriticalSection crit_;
84 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); 100 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_);
85 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); 101 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
86 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); 102 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
103 rtc::RateTracker render_fps_tracker_total_ GUARDED_BY(crit_);
104 SampleCounter render_width_counter_ GUARDED_BY(crit_);
105 SampleCounter render_height_counter_ GUARDED_BY(crit_);
87 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); 106 ReportBlockStats report_block_stats_ GUARDED_BY(crit_);
88 }; 107 };
89 108
90 } // namespace webrtc 109 } // namespace webrtc
91 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ 110 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698