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, |
55 int64_t rtt_ms); | 56 int64_t rtt_ms); |
56 | 57 |
| 58 void OnPreDecode(const EncodedImage& encoded_image, |
| 59 const CodecSpecificInfo* codec_specific_info); |
| 60 |
57 // Overrides VCMReceiveStatisticsCallback. | 61 // Overrides VCMReceiveStatisticsCallback. |
58 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; | 62 void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override; |
59 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; | 63 void OnFrameCountsUpdated(const FrameCounts& frame_counts) override; |
60 void OnDiscardedPacketsUpdated(int discarded_packets) override; | 64 void OnDiscardedPacketsUpdated(int discarded_packets) override; |
61 | 65 |
62 // Overrides RtcpStatisticsCallback. | 66 // Overrides RtcpStatisticsCallback. |
63 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics, | 67 void StatisticsUpdated(const webrtc::RtcpStatistics& statistics, |
64 uint32_t ssrc) override; | 68 uint32_t ssrc) override; |
65 void CNameChanged(const char* cname, uint32_t ssrc) override; | 69 void CNameChanged(const char* cname, uint32_t ssrc) override; |
66 | 70 |
67 // Overrides RtcpPacketTypeCounterObserver. | 71 // Overrides RtcpPacketTypeCounterObserver. |
68 void RtcpPacketTypesCounterUpdated( | 72 void RtcpPacketTypesCounterUpdated( |
69 uint32_t ssrc, | 73 uint32_t ssrc, |
70 const RtcpPacketTypeCounter& packet_counter) override; | 74 const RtcpPacketTypeCounter& packet_counter) override; |
71 // Overrides StreamDataCountersCallback. | 75 // Overrides StreamDataCountersCallback. |
72 void DataCountersUpdated(const webrtc::StreamDataCounters& counters, | 76 void DataCountersUpdated(const webrtc::StreamDataCounters& counters, |
73 uint32_t ssrc) override; | 77 uint32_t ssrc) override; |
74 | 78 |
75 private: | 79 private: |
76 struct SampleCounter { | 80 struct SampleCounter { |
77 SampleCounter() : sum(0), num_samples(0) {} | 81 SampleCounter() : sum(0), num_samples(0) {} |
78 void Add(int sample); | 82 void Add(int sample); |
79 int Avg(int min_required_samples) const; | 83 int Avg(int min_required_samples) const; |
80 | 84 |
81 private: | 85 private: |
82 int sum; | 86 int sum; |
83 int num_samples; | 87 int num_samples; |
84 }; | 88 }; |
| 89 struct QpCounters { |
| 90 SampleCounter vp8; |
| 91 }; |
85 | 92 |
86 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 93 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
87 | 94 |
88 Clock* const clock_; | 95 Clock* const clock_; |
89 | 96 |
90 mutable rtc::CriticalSection crit_; | 97 mutable rtc::CriticalSection crit_; |
91 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); | 98 VideoReceiveStream::Stats stats_ GUARDED_BY(crit_); |
92 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); | 99 RateStatistics decode_fps_estimator_ GUARDED_BY(crit_); |
93 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); | 100 RateStatistics renders_fps_estimator_ GUARDED_BY(crit_); |
94 rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_); | 101 rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_); |
95 rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_); | 102 rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_); |
96 SampleCounter render_width_counter_ GUARDED_BY(crit_); | 103 SampleCounter render_width_counter_ GUARDED_BY(crit_); |
97 SampleCounter render_height_counter_ GUARDED_BY(crit_); | 104 SampleCounter render_height_counter_ GUARDED_BY(crit_); |
98 SampleCounter decode_time_counter_ GUARDED_BY(crit_); | 105 SampleCounter decode_time_counter_ GUARDED_BY(crit_); |
99 SampleCounter delay_counter_ GUARDED_BY(crit_); | 106 SampleCounter delay_counter_ GUARDED_BY(crit_); |
100 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); | 107 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); |
| 108 QpCounters qp_counters_; // Only accessed on the decoding thread. |
101 }; | 109 }; |
102 | 110 |
103 } // namespace webrtc | 111 } // namespace webrtc |
104 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ | 112 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ |
OLD | NEW |