OLD | NEW |
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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "webrtc/video_engine/report_block_stats.h" | 23 #include "webrtc/video_engine/report_block_stats.h" |
24 #include "webrtc/video_engine/vie_channel.h" | 24 #include "webrtc/video_engine/vie_channel.h" |
25 #include "webrtc/video_receive_stream.h" | 25 #include "webrtc/video_receive_stream.h" |
26 #include "webrtc/video_renderer.h" | 26 #include "webrtc/video_renderer.h" |
27 | 27 |
28 namespace webrtc { | 28 namespace webrtc { |
29 | 29 |
30 class Clock; | 30 class Clock; |
31 class ViECodec; | 31 class ViECodec; |
32 class ViEDecoderObserver; | 32 class ViEDecoderObserver; |
| 33 struct CodecSpecificInfo; |
33 | 34 |
34 class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback, | 35 class ReceiveStatisticsProxy : 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(int width, int height); | 46 void OnRenderedFrame(int width, int height); |
46 void OnIncomingPayloadType(int payload_type); | 47 void OnIncomingPayloadType(int payload_type); |
47 void OnIncomingRate(unsigned int framerate, unsigned int bitrate_bps); | 48 void OnIncomingRate(unsigned int framerate, unsigned int bitrate_bps); |
48 void OnDecoderTiming(int decode_ms, | 49 void OnDecoderTiming(int decode_ms, |
49 int max_decode_ms, | 50 int max_decode_ms, |
50 int current_delay_ms, | 51 int current_delay_ms, |
51 int target_delay_ms, | 52 int target_delay_ms, |
52 int jitter_buffer_ms, | 53 int jitter_buffer_ms, |
53 int min_playout_delay_ms, | 54 int min_playout_delay_ms, |
54 int render_delay_ms); | 55 int render_delay_ms); |
| 56 void Encoded(const EncodedImage& encoded_image, |
| 57 const CodecSpecificInfo* codec_specific_info); |
55 | 58 |
56 // Overrides VCMReceiveStatisticsCallback. | 59 // Overrides VCMReceiveStatisticsCallback. |
57 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; | 60 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; |
58 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; | 61 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; |
59 void OnDiscardedPacketsUpdated(int discarded_packets) override; | 62 void OnDiscardedPacketsUpdated(int discarded_packets) override; |
60 | 63 |
61 // Overrides RtcpStatisticsCallback. | 64 // Overrides RtcpStatisticsCallback. |
62 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics, | 65 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics, |
63 uint32_t ssrc) override; | 66 uint32_t ssrc) override; |
64 void CNameChanged(const char* cname, uint32_t ssrc) override; | 67 void CNameChanged(const char* cname, uint32_t ssrc) override; |
65 | 68 |
66 // Overrides RtcpPacketTypeCounterObserver. | 69 // Overrides RtcpPacketTypeCounterObserver. |
67 void RtcpPacketTypesCounterUpdated( | 70 void RtcpPacketTypesCounterUpdated( |
68 uint32_t ssrc, | 71 uint32_t ssrc, |
69 const RtcpPacketTypeCounter& packet_counter) override; | 72 const RtcpPacketTypeCounter& packet_counter) override; |
70 // Overrides StreamDataCountersCallback. | 73 // Overrides StreamDataCountersCallback. |
71 void DataCountersUpdated(const webrtc::StreamDataCounters& counters, | 74 void DataCountersUpdated(const webrtc::StreamDataCounters& counters, |
72 uint32_t ssrc) override; | 75 uint32_t ssrc) override; |
73 | 76 |
74 private: | 77 private: |
75 struct SampleCounter { | 78 struct SampleCounter { |
76 SampleCounter() : sum(0), num_samples(0) {} | 79 SampleCounter() : sum(0), num_samples(0) {} |
77 void Add(int sample); | 80 void Add(int sample); |
78 int Avg(int min_required_samples) const; | 81 int Avg(int min_required_samples) const; |
79 | 82 |
80 private: | 83 private: |
81 int sum; | 84 int sum; |
82 int num_samples; | 85 int num_samples; |
83 }; | 86 }; |
| 87 struct QpCounters { |
| 88 SampleCounter vp8; |
| 89 }; |
84 | 90 |
85 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 91 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
86 | 92 |
87 Clock* const clock_; | 93 Clock* const clock_; |
88 | 94 |
89 mutable rtc::CriticalSection crit_; | 95 mutable rtc::CriticalSection crit_; |
90 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); | 96 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); |
91 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); | 97 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); |
92 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); | 98 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); |
93 rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_); | 99 rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_); |
94 SampleCounter render_width_counter_ GUARDED_BY(crit_); | 100 SampleCounter render_width_counter_ GUARDED_BY(crit_); |
95 SampleCounter render_height_counter_ GUARDED_BY(crit_); | 101 SampleCounter render_height_counter_ GUARDED_BY(crit_); |
96 SampleCounter decode_time_counter_ GUARDED_BY(crit_); | 102 SampleCounter decode_time_counter_ GUARDED_BY(crit_); |
97 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); | 103 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); |
| 104 QpCounters qp_counters_; // Only accessed on the decoding thread. |
98 }; | 105 }; |
99 | 106 |
100 } // namespace webrtc | 107 } // namespace webrtc |
101 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ | 108 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ |
OLD | NEW |