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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void SendSideDelayUpdated(int avg_delay_ms, | 104 void SendSideDelayUpdated(int avg_delay_ms, |
105 int max_delay_ms, | 105 int max_delay_ms, |
106 uint32_t ssrc) override; | 106 uint32_t ssrc) override; |
107 | 107 |
108 private: | 108 private: |
109 class SampleCounter { | 109 class SampleCounter { |
110 public: | 110 public: |
111 SampleCounter() : sum(0), num_samples(0) {} | 111 SampleCounter() : sum(0), num_samples(0) {} |
112 ~SampleCounter() {} | 112 ~SampleCounter() {} |
113 void Add(int sample); | 113 void Add(int sample); |
114 int Avg(int min_required_samples) const; | 114 int Avg(int64_t min_required_samples) const; |
115 | 115 |
116 private: | 116 private: |
117 int sum; | 117 int64_t sum; |
118 int num_samples; | 118 int64_t num_samples; |
119 }; | 119 }; |
120 class BoolSampleCounter { | 120 class BoolSampleCounter { |
121 public: | 121 public: |
122 BoolSampleCounter() : sum(0), num_samples(0) {} | 122 BoolSampleCounter() : sum(0), num_samples(0) {} |
123 ~BoolSampleCounter() {} | 123 ~BoolSampleCounter() {} |
124 void Add(bool sample); | 124 void Add(bool sample); |
125 int Percent(int min_required_samples) const; | 125 void Add(bool sample, int64_t count); |
126 int Permille(int min_required_samples) const; | 126 int Percent(int64_t min_required_samples) const; |
| 127 int Permille(int64_t min_required_samples) const; |
127 | 128 |
128 private: | 129 private: |
129 int Fraction(int min_required_samples, float multiplier) const; | 130 int Fraction(int64_t min_required_samples, float multiplier) const; |
130 int sum; | 131 int64_t sum; |
131 int num_samples; | 132 int64_t num_samples; |
132 }; | 133 }; |
133 struct StatsUpdateTimes { | 134 struct StatsUpdateTimes { |
134 StatsUpdateTimes() : resolution_update_ms(0), bitrate_update_ms(0) {} | 135 StatsUpdateTimes() : resolution_update_ms(0), bitrate_update_ms(0) {} |
135 int64_t resolution_update_ms; | 136 int64_t resolution_update_ms; |
136 int64_t bitrate_update_ms; | 137 int64_t bitrate_update_ms; |
137 }; | 138 }; |
| 139 struct TargetRateUpdates { |
| 140 TargetRateUpdates() |
| 141 : pause_resume_events(0), last_paused_or_resumed(false), last_ms(-1) {} |
| 142 int pause_resume_events; |
| 143 bool last_paused_or_resumed; |
| 144 int64_t last_ms; |
| 145 }; |
138 struct QpCounters { | 146 struct QpCounters { |
139 SampleCounter vp8; // QP range: 0-127 | 147 SampleCounter vp8; // QP range: 0-127 |
140 SampleCounter vp9; // QP range: 0-255 | 148 SampleCounter vp9; // QP range: 0-255 |
141 SampleCounter h264; // QP range: 0-51 | 149 SampleCounter h264; // QP range: 0-51 |
142 }; | 150 }; |
143 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 151 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
144 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 152 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
145 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 153 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
146 | 154 |
147 Clock* const clock_; | 155 Clock* const clock_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 BoolSampleCounter cpu_limited_frame_counter_; | 190 BoolSampleCounter cpu_limited_frame_counter_; |
183 BoolSampleCounter bw_limited_frame_counter_; | 191 BoolSampleCounter bw_limited_frame_counter_; |
184 SampleCounter bw_resolutions_disabled_counter_; | 192 SampleCounter bw_resolutions_disabled_counter_; |
185 SampleCounter delay_counter_; | 193 SampleCounter delay_counter_; |
186 SampleCounter max_delay_counter_; | 194 SampleCounter max_delay_counter_; |
187 rtc::RateTracker input_frame_rate_tracker_; | 195 rtc::RateTracker input_frame_rate_tracker_; |
188 RateCounter input_fps_counter_; | 196 RateCounter input_fps_counter_; |
189 RateCounter sent_fps_counter_; | 197 RateCounter sent_fps_counter_; |
190 int64_t first_rtcp_stats_time_ms_; | 198 int64_t first_rtcp_stats_time_ms_; |
191 int64_t first_rtp_stats_time_ms_; | 199 int64_t first_rtp_stats_time_ms_; |
| 200 BoolSampleCounter paused_time_counter_; |
| 201 TargetRateUpdates target_rate_updates_; |
192 ReportBlockStats report_block_stats_; | 202 ReportBlockStats report_block_stats_; |
193 const VideoSendStream::Stats start_stats_; | 203 const VideoSendStream::Stats start_stats_; |
194 std::map<int, QpCounters> | 204 std::map<int, QpCounters> |
195 qp_counters_; // QP counters mapped by spatial idx. | 205 qp_counters_; // QP counters mapped by spatial idx. |
196 }; | 206 }; |
197 | 207 |
198 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); | 208 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |
199 }; | 209 }; |
200 | 210 |
201 } // namespace webrtc | 211 } // namespace webrtc |
202 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 212 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
OLD | NEW |