Chromium Code Reviews| 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 bw_limited = bw_limited_sent_frame_counter_.Percent(kMinRequiredSamples); | |
| 67 if (bw_limited != -1) { | |
| 68 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", | |
|
pbos-webrtc
2015/09/11 11:28:23
Can we report this per SSRC/simulcast layer? I thi
stefan-webrtc
2015/09/16 07:49:27
It doesn't scale very well, and as we make simulca
åsapersson
2015/09/17 14:12:03
Added the average number of resolutions disabled w
| |
| 69 bw_limited); | |
| 70 } | |
| 65 } | 71 } |
| 66 | 72 |
| 67 void SendStatisticsProxy::OutgoingRate(const int video_channel, | 73 void SendStatisticsProxy::OutgoingRate(const int video_channel, |
| 68 const unsigned int framerate, | 74 const unsigned int framerate, |
| 69 const unsigned int bitrate) { | 75 const unsigned int bitrate) { |
| 70 rtc::CritScope lock(&crit_); | 76 rtc::CritScope lock(&crit_); |
| 71 stats_.encode_frame_rate = framerate; | 77 stats_.encode_frame_rate = framerate; |
| 72 stats_.media_bitrate_bps = bitrate; | 78 stats_.media_bitrate_bps = bitrate; |
| 73 } | 79 } |
| 74 | 80 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 161 |
| 156 rtc::CritScope lock(&crit_); | 162 rtc::CritScope lock(&crit_); |
| 157 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 163 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 158 if (stats == nullptr) | 164 if (stats == nullptr) |
| 159 return; | 165 return; |
| 160 | 166 |
| 161 stats->width = encoded_image._encodedWidth; | 167 stats->width = encoded_image._encodedWidth; |
| 162 stats->height = encoded_image._encodedHeight; | 168 stats->height = encoded_image._encodedHeight; |
| 163 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 169 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
| 164 | 170 |
| 171 if (encoded_image.adapt_reason_.bw_limited_resolution_available) { | |
| 172 bw_limited_sent_frame_counter_.Add( | |
| 173 encoded_image.adapt_reason_.bw_limited_resolution); | |
| 174 } | |
| 175 | |
| 165 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 176 // 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 | 177 // different threads and there is no guarantee that one frame of all layers |
| 167 // are encoded before the next start. | 178 // are encoded before the next start. |
| 168 if (last_sent_frame_timestamp_ > 0 && | 179 if (last_sent_frame_timestamp_ > 0 && |
| 169 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 180 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
| 170 sent_frame_rate_tracker_total_.Update(1); | 181 sent_frame_rate_tracker_total_.Update(1); |
| 171 sent_width_counter_.Add(max_sent_width_per_timestamp_); | 182 sent_width_counter_.Add(max_sent_width_per_timestamp_); |
| 172 sent_height_counter_.Add(max_sent_height_per_timestamp_); | 183 sent_height_counter_.Add(max_sent_height_per_timestamp_); |
| 173 max_sent_width_per_timestamp_ = 0; | 184 max_sent_width_per_timestamp_ = 0; |
| 174 max_sent_height_per_timestamp_ = 0; | 185 max_sent_height_per_timestamp_ = 0; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 sum += sample; | 278 sum += sample; |
| 268 ++num_samples; | 279 ++num_samples; |
| 269 } | 280 } |
| 270 | 281 |
| 271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 282 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 272 if (num_samples < min_required_samples || num_samples == 0) | 283 if (num_samples < min_required_samples || num_samples == 0) |
| 273 return -1; | 284 return -1; |
| 274 return sum / num_samples; | 285 return sum / num_samples; |
| 275 } | 286 } |
| 276 | 287 |
| 288 void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) { | |
| 289 if (sample) | |
| 290 ++sum; | |
| 291 ++num_samples; | |
| 292 } | |
| 293 | |
| 294 int SendStatisticsProxy::BoolSampleCounter::Percent( | |
| 295 int min_required_samples) const { | |
| 296 if (num_samples < min_required_samples || num_samples == 0) | |
| 297 return -1; | |
| 298 return sum * 100 / num_samples; | |
| 299 } | |
| 277 } // namespace webrtc | 300 } // namespace webrtc |
| OLD | NEW |