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