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_frame_counter_.Percent(kMinRequiredSamples); | |
| 67 if (bw_limited != -1) { | |
| 68 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", | |
| 69 bw_limited); | |
| 70 } | |
| 71 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); | |
|
stefan-webrtc
2015/09/23 15:10:34
Same as in the other CL, is this average per frame
åsapersson
2015/09/24 08:23:45
Per frame.
If a frame has resolutions disabled, |b
| |
| 72 if (num_disabled != -1) { | |
| 73 RTC_HISTOGRAM_ENUMERATION( | |
| 74 "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); | |
| 75 } | |
| 65 } | 76 } |
| 66 | 77 |
| 67 void SendStatisticsProxy::OutgoingRate(const int video_channel, | 78 void SendStatisticsProxy::OutgoingRate(const int video_channel, |
| 68 const unsigned int framerate, | 79 const unsigned int framerate, |
| 69 const unsigned int bitrate) { | 80 const unsigned int bitrate) { |
| 70 rtc::CritScope lock(&crit_); | 81 rtc::CritScope lock(&crit_); |
| 71 stats_.encode_frame_rate = framerate; | 82 stats_.encode_frame_rate = framerate; |
| 72 stats_.media_bitrate_bps = bitrate; | 83 stats_.media_bitrate_bps = bitrate; |
| 73 } | 84 } |
| 74 | 85 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 166 |
| 156 rtc::CritScope lock(&crit_); | 167 rtc::CritScope lock(&crit_); |
| 157 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 168 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 158 if (stats == nullptr) | 169 if (stats == nullptr) |
| 159 return; | 170 return; |
| 160 | 171 |
| 161 stats->width = encoded_image._encodedWidth; | 172 stats->width = encoded_image._encodedWidth; |
| 162 stats->height = encoded_image._encodedHeight; | 173 stats->height = encoded_image._encodedHeight; |
| 163 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 174 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
| 164 | 175 |
| 176 if (encoded_image.adapt_reason_.bw_available) { | |
| 177 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | |
| 178 bw_limited_frame_counter_.Add(bw_limited); | |
| 179 if (bw_limited) { | |
| 180 bw_resolutions_disabled_counter_.Add( | |
| 181 encoded_image.adapt_reason_.bw_resolutions_disabled); | |
| 182 } | |
| 183 } | |
| 184 | |
| 165 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 185 // 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 | 186 // different threads and there is no guarantee that one frame of all layers |
| 167 // are encoded before the next start. | 187 // are encoded before the next start. |
| 168 if (last_sent_frame_timestamp_ > 0 && | 188 if (last_sent_frame_timestamp_ > 0 && |
| 169 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 189 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
| 170 sent_frame_rate_tracker_total_.Update(1); | 190 sent_frame_rate_tracker_total_.Update(1); |
| 171 sent_width_counter_.Add(max_sent_width_per_timestamp_); | 191 sent_width_counter_.Add(max_sent_width_per_timestamp_); |
| 172 sent_height_counter_.Add(max_sent_height_per_timestamp_); | 192 sent_height_counter_.Add(max_sent_height_per_timestamp_); |
| 173 max_sent_width_per_timestamp_ = 0; | 193 max_sent_width_per_timestamp_ = 0; |
| 174 max_sent_height_per_timestamp_ = 0; | 194 max_sent_height_per_timestamp_ = 0; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 } | 284 } |
| 265 | 285 |
| 266 void SendStatisticsProxy::SampleCounter::Add(int sample) { | 286 void SendStatisticsProxy::SampleCounter::Add(int sample) { |
| 267 sum += sample; | 287 sum += sample; |
| 268 ++num_samples; | 288 ++num_samples; |
| 269 } | 289 } |
| 270 | 290 |
| 271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 291 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 272 if (num_samples < min_required_samples || num_samples == 0) | 292 if (num_samples < min_required_samples || num_samples == 0) |
| 273 return -1; | 293 return -1; |
| 274 return sum / num_samples; | 294 return (sum + (num_samples / 2)) / num_samples; |
| 275 } | 295 } |
| 276 | 296 |
| 297 void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) { | |
| 298 if (sample) | |
| 299 ++sum; | |
| 300 ++num_samples; | |
| 301 } | |
| 302 | |
| 303 int SendStatisticsProxy::BoolSampleCounter::Percent( | |
| 304 int min_required_samples) const { | |
| 305 if (num_samples < min_required_samples || num_samples == 0) | |
| 306 return -1; | |
| 307 return sum * 100 / num_samples; | |
| 308 } | |
| 277 } // namespace webrtc | 309 } // namespace webrtc |
| OLD | NEW |