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 |
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 <map> | 14 #include <map> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "webrtc/call/video_receive_stream.h" | 17 #include "webrtc/call/video_receive_stream.h" |
18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
19 #include "webrtc/common_video/include/frame_callback.h" | 19 #include "webrtc/common_video/include/frame_callback.h" |
20 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 20 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
21 #include "webrtc/rtc_base/criticalsection.h" | 21 #include "webrtc/rtc_base/criticalsection.h" |
22 #include "webrtc/rtc_base/moving_max_counter.h" | 22 #include "webrtc/rtc_base/moving_max_counter.h" |
| 23 #include "webrtc/rtc_base/optional.h" |
23 #include "webrtc/rtc_base/rate_statistics.h" | 24 #include "webrtc/rtc_base/rate_statistics.h" |
24 #include "webrtc/rtc_base/ratetracker.h" | 25 #include "webrtc/rtc_base/ratetracker.h" |
25 #include "webrtc/rtc_base/thread_annotations.h" | 26 #include "webrtc/rtc_base/thread_annotations.h" |
26 #include "webrtc/video/quality_threshold.h" | 27 #include "webrtc/video/quality_threshold.h" |
27 #include "webrtc/video/report_block_stats.h" | 28 #include "webrtc/video/report_block_stats.h" |
28 #include "webrtc/video/stats_counter.h" | 29 #include "webrtc/video/stats_counter.h" |
29 #include "webrtc/video/video_stream_decoder.h" | 30 #include "webrtc/video/video_stream_decoder.h" |
30 | 31 |
31 namespace webrtc { | 32 namespace webrtc { |
32 | 33 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 uint32_t ssrc) override; | 92 uint32_t ssrc) override; |
92 | 93 |
93 // Implements CallStatsObserver. | 94 // Implements CallStatsObserver. |
94 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 95 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
95 | 96 |
96 private: | 97 private: |
97 struct SampleCounter { | 98 struct SampleCounter { |
98 SampleCounter() : sum(0), num_samples(0) {} | 99 SampleCounter() : sum(0), num_samples(0) {} |
99 void Add(int sample); | 100 void Add(int sample); |
100 int Avg(int64_t min_required_samples) const; | 101 int Avg(int64_t min_required_samples) const; |
| 102 int Max() const; |
101 void Reset(); | 103 void Reset(); |
102 | 104 |
103 private: | 105 private: |
104 int64_t sum; | 106 int64_t sum; |
105 int64_t num_samples; | 107 int64_t num_samples; |
| 108 rtc::Optional<int> max; |
106 }; | 109 }; |
107 struct QpCounters { | 110 struct QpCounters { |
108 SampleCounter vp8; | 111 SampleCounter vp8; |
109 }; | 112 }; |
110 | 113 |
| 114 struct ContentSpecificStats { |
| 115 SampleCounter e2e_delay_counter; |
| 116 SampleCounter interframe_delay_counter; |
| 117 int64_t flow_duration_ms = 0; |
| 118 int64_t total_media_bytes = 0; |
| 119 SampleCounter received_width; |
| 120 SampleCounter received_height; |
| 121 SampleCounter qp_counter; |
| 122 }; |
| 123 |
111 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 124 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
112 | 125 |
113 void QualitySample() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 126 void QualitySample() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
114 | 127 |
115 // Removes info about old frames and then updates the framerate. | 128 // Removes info about old frames and then updates the framerate. |
116 void UpdateFramerate(int64_t now_ms) const EXCLUSIVE_LOCKS_REQUIRED(crit_); | 129 void UpdateFramerate(int64_t now_ms) const EXCLUSIVE_LOCKS_REQUIRED(crit_); |
117 | 130 |
118 Clock* const clock_; | 131 Clock* const clock_; |
119 // Ownership of this object lies with the owner of the ReceiveStatisticsProxy | 132 // Ownership of this object lies with the owner of the ReceiveStatisticsProxy |
120 // instance. Lifetime is guaranteed to outlive |this|. | 133 // instance. Lifetime is guaranteed to outlive |this|. |
(...skipping 20 matching lines...) Expand all Loading... |
141 rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_); | 154 rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_); |
142 rtc::RateTracker total_byte_tracker_ GUARDED_BY(crit_); | 155 rtc::RateTracker total_byte_tracker_ GUARDED_BY(crit_); |
143 SampleCounter render_width_counter_ GUARDED_BY(crit_); | 156 SampleCounter render_width_counter_ GUARDED_BY(crit_); |
144 SampleCounter render_height_counter_ GUARDED_BY(crit_); | 157 SampleCounter render_height_counter_ GUARDED_BY(crit_); |
145 SampleCounter sync_offset_counter_ GUARDED_BY(crit_); | 158 SampleCounter sync_offset_counter_ GUARDED_BY(crit_); |
146 SampleCounter decode_time_counter_ GUARDED_BY(crit_); | 159 SampleCounter decode_time_counter_ GUARDED_BY(crit_); |
147 SampleCounter jitter_buffer_delay_counter_ GUARDED_BY(crit_); | 160 SampleCounter jitter_buffer_delay_counter_ GUARDED_BY(crit_); |
148 SampleCounter target_delay_counter_ GUARDED_BY(crit_); | 161 SampleCounter target_delay_counter_ GUARDED_BY(crit_); |
149 SampleCounter current_delay_counter_ GUARDED_BY(crit_); | 162 SampleCounter current_delay_counter_ GUARDED_BY(crit_); |
150 SampleCounter delay_counter_ GUARDED_BY(crit_); | 163 SampleCounter delay_counter_ GUARDED_BY(crit_); |
151 SampleCounter e2e_delay_counter_video_ GUARDED_BY(crit_); | |
152 SampleCounter e2e_delay_counter_screenshare_ GUARDED_BY(crit_); | |
153 SampleCounter interframe_delay_counter_video_ GUARDED_BY(crit_); | |
154 SampleCounter interframe_delay_counter_screenshare_ GUARDED_BY(crit_); | |
155 int64_t e2e_delay_max_ms_video_ GUARDED_BY(crit_); | |
156 int64_t e2e_delay_max_ms_screenshare_ GUARDED_BY(crit_); | |
157 int64_t interframe_delay_max_ms_video_ GUARDED_BY(crit_); | |
158 int64_t interframe_delay_max_ms_screenshare_ GUARDED_BY(crit_); | |
159 mutable rtc::MovingMaxCounter<int> interframe_delay_max_moving_ | 164 mutable rtc::MovingMaxCounter<int> interframe_delay_max_moving_ |
160 GUARDED_BY(crit_); | 165 GUARDED_BY(crit_); |
| 166 std::map<VideoContentType, ContentSpecificStats> content_specific_stats_ |
| 167 GUARDED_BY(crit_); |
| 168 SampleCounter e2e_delay_counter GUARDED_BY(crit_); |
| 169 SampleCounter interframe_delay_counter GUARDED_BY(crit_); |
161 MaxCounter freq_offset_counter_ GUARDED_BY(crit_); | 170 MaxCounter freq_offset_counter_ GUARDED_BY(crit_); |
162 int64_t first_report_block_time_ms_ GUARDED_BY(crit_); | 171 int64_t first_report_block_time_ms_ GUARDED_BY(crit_); |
163 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); | 172 ReportBlockStats report_block_stats_ GUARDED_BY(crit_); |
164 QpCounters qp_counters_; // Only accessed on the decoding thread. | 173 QpCounters qp_counters_; // Only accessed on the decoding thread. |
165 std::map<uint32_t, StreamDataCounters> rtx_stats_ GUARDED_BY(crit_); | 174 std::map<uint32_t, StreamDataCounters> rtx_stats_ GUARDED_BY(crit_); |
166 int64_t avg_rtt_ms_ GUARDED_BY(crit_); | 175 int64_t avg_rtt_ms_ GUARDED_BY(crit_); |
167 mutable std::map<int64_t, size_t> frame_window_ GUARDED_BY(&crit_); | 176 mutable std::map<int64_t, size_t> frame_window_ GUARDED_BY(&crit_); |
168 VideoContentType last_content_type_ GUARDED_BY(&crit_); | 177 VideoContentType last_content_type_ GUARDED_BY(&crit_); |
169 rtc::Optional<int64_t> last_decoded_frame_time_ms_ GUARDED_BY(&crit_); | 178 rtc::Optional<int64_t> last_decoded_frame_time_ms_ GUARDED_BY(&crit_); |
170 rtc::Optional<TimingFrameInfo> timing_frame_info_ GUARDED_BY(&crit_); | 179 rtc::Optional<TimingFrameInfo> timing_frame_info_ GUARDED_BY(&crit_); |
171 }; | 180 }; |
172 | 181 |
173 } // namespace webrtc | 182 } // namespace webrtc |
174 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ | 183 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_ |
OLD | NEW |