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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 } | 55 } |
56 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); | 56 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); |
57 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); | 57 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); |
58 if (sent_width != -1) { | 58 if (sent_width != -1) { |
59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); | 59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); |
60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); | 60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); |
61 } | 61 } |
62 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); | 62 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); |
63 if (encode_ms != -1) | 63 if (encode_ms != -1) |
64 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); | 64 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); |
65 | |
66 int quality_limited = | |
67 quality_limited_frame_counter_.Percent(kMinRequiredSamples); | |
68 if (quality_limited != -1) { | |
69 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.QualityLimitedResolutionInPercent", | |
70 quality_limited); | |
71 } | |
72 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); | |
stefan-webrtc
2015/09/23 15:08:07
What will this average represent? The average numb
åsapersson
2015/09/24 08:16:17
If a frame is downscaled, |quality_downscales_coun
stefan-webrtc
2015/09/28 13:44:29
Ok! I was mostly wondering if it was an average ov
| |
73 if (downscales != -1) { | |
74 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.QualityLimitedResolutionDownscales", | |
75 downscales, 20); | |
76 } | |
65 } | 77 } |
66 | 78 |
67 void SendStatisticsProxy::OutgoingRate(const int video_channel, | 79 void SendStatisticsProxy::OutgoingRate(const int video_channel, |
68 const unsigned int framerate, | 80 const unsigned int framerate, |
69 const unsigned int bitrate) { | 81 const unsigned int bitrate) { |
70 rtc::CritScope lock(&crit_); | 82 rtc::CritScope lock(&crit_); |
71 stats_.encode_frame_rate = framerate; | 83 stats_.encode_frame_rate = framerate; |
72 stats_.media_bitrate_bps = bitrate; | 84 stats_.media_bitrate_bps = bitrate; |
73 } | 85 } |
74 | 86 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 167 |
156 rtc::CritScope lock(&crit_); | 168 rtc::CritScope lock(&crit_); |
157 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 169 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
158 if (stats == nullptr) | 170 if (stats == nullptr) |
159 return; | 171 return; |
160 | 172 |
161 stats->width = encoded_image._encodedWidth; | 173 stats->width = encoded_image._encodedWidth; |
162 stats->height = encoded_image._encodedHeight; | 174 stats->height = encoded_image._encodedHeight; |
163 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 175 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
164 | 176 |
177 if (encoded_image._length > 0) { | |
pbos-webrtc
2015/09/28 14:30:18
!= kSkipFrame please
| |
178 if (encoded_image.adapt_reason_.quality_available) { | |
179 bool downscaled = | |
180 encoded_image.adapt_reason_.quality_resolution_downscales > 0; | |
181 quality_limited_frame_counter_.Add(downscaled); | |
182 if (downscaled) { | |
183 quality_downscales_counter_.Add( | |
184 encoded_image.adapt_reason_.quality_resolution_downscales); | |
185 } | |
186 } | |
187 } | |
188 | |
165 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 189 // TODO(asapersson): This is incorrect if simulcast layers are encoded on |
166 // different threads and there is no guarantee that one frame of all layers | 190 // different threads and there is no guarantee that one frame of all layers |
167 // are encoded before the next start. | 191 // are encoded before the next start. |
168 if (last_sent_frame_timestamp_ > 0 && | 192 if (last_sent_frame_timestamp_ > 0 && |
169 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 193 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
170 sent_frame_rate_tracker_total_.Update(1); | 194 sent_frame_rate_tracker_total_.Update(1); |
171 sent_width_counter_.Add(max_sent_width_per_timestamp_); | 195 sent_width_counter_.Add(max_sent_width_per_timestamp_); |
172 sent_height_counter_.Add(max_sent_height_per_timestamp_); | 196 sent_height_counter_.Add(max_sent_height_per_timestamp_); |
173 max_sent_width_per_timestamp_ = 0; | 197 max_sent_width_per_timestamp_ = 0; |
174 max_sent_height_per_timestamp_ = 0; | 198 max_sent_height_per_timestamp_ = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 sum += sample; | 291 sum += sample; |
268 ++num_samples; | 292 ++num_samples; |
269 } | 293 } |
270 | 294 |
271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 295 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
272 if (num_samples < min_required_samples || num_samples == 0) | 296 if (num_samples < min_required_samples || num_samples == 0) |
273 return -1; | 297 return -1; |
274 return sum / num_samples; | 298 return sum / num_samples; |
275 } | 299 } |
276 | 300 |
301 void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) { | |
302 if (sample) | |
303 ++sum; | |
304 ++num_samples; | |
305 } | |
306 | |
307 int SendStatisticsProxy::BoolSampleCounter::Percent( | |
308 int min_required_samples) const { | |
309 if (num_samples < min_required_samples || num_samples == 0) | |
310 return -1; | |
311 return sum * 100 / num_samples; | |
312 } | |
277 } // namespace webrtc | 313 } // namespace webrtc |
OLD | NEW |