Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: webrtc/video/send_statistics_proxy.cc

Issue 1325153009: Add histogram for percentage of sent frames that are limited in resolution due to quality. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removed bool Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); 64 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
65 if (encode_ms != -1) 65 if (encode_ms != -1)
66 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); 66 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms);
67 67
68 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); 68 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
69 if (key_frames_permille != -1) { 69 if (key_frames_permille != -1) {
70 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille", 70 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille",
71 key_frames_permille); 71 key_frames_permille);
72 } 72 }
73 int quality_limited =
74 quality_limited_frame_counter_.Percent(kMinRequiredSamples);
75 if (quality_limited != -1) {
76 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.QualityLimitedResolutionInPercent",
77 quality_limited);
78 }
79 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples);
80 if (downscales != -1) {
81 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.QualityLimitedResolutionDownscales",
82 downscales, 20);
83 }
73 } 84 }
74 85
75 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { 86 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) {
76 rtc::CritScope lock(&crit_); 87 rtc::CritScope lock(&crit_);
77 stats_.encode_frame_rate = framerate; 88 stats_.encode_frame_rate = framerate;
78 stats_.media_bitrate_bps = bitrate; 89 stats_.media_bitrate_bps = bitrate;
79 } 90 }
80 91
81 void SendStatisticsProxy::CpuOveruseMetricsUpdated( 92 void SendStatisticsProxy::CpuOveruseMetricsUpdated(
82 const CpuOveruseMetrics& metrics) { 93 const CpuOveruseMetrics& metrics) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 174 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
164 if (stats == nullptr) 175 if (stats == nullptr)
165 return; 176 return;
166 177
167 stats->width = encoded_image._encodedWidth; 178 stats->width = encoded_image._encodedWidth;
168 stats->height = encoded_image._encodedHeight; 179 stats->height = encoded_image._encodedHeight;
169 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); 180 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
170 181
171 key_frame_counter_.Add(encoded_image._frameType == kKeyFrame); 182 key_frame_counter_.Add(encoded_image._frameType == kKeyFrame);
172 183
184 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) {
185 bool downscaled =
186 encoded_image.adapt_reason_.quality_resolution_downscales > 0;
187 quality_limited_frame_counter_.Add(downscaled);
188 if (downscaled) {
189 quality_downscales_counter_.Add(
190 encoded_image.adapt_reason_.quality_resolution_downscales);
191 }
192 }
193
173 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 194 // TODO(asapersson): This is incorrect if simulcast layers are encoded on
174 // different threads and there is no guarantee that one frame of all layers 195 // different threads and there is no guarantee that one frame of all layers
175 // are encoded before the next start. 196 // are encoded before the next start.
176 if (last_sent_frame_timestamp_ > 0 && 197 if (last_sent_frame_timestamp_ > 0 &&
177 encoded_image._timeStamp != last_sent_frame_timestamp_) { 198 encoded_image._timeStamp != last_sent_frame_timestamp_) {
178 sent_frame_rate_tracker_.AddSamples(1); 199 sent_frame_rate_tracker_.AddSamples(1);
179 sent_width_counter_.Add(max_sent_width_per_timestamp_); 200 sent_width_counter_.Add(max_sent_width_per_timestamp_);
180 sent_height_counter_.Add(max_sent_height_per_timestamp_); 201 sent_height_counter_.Add(max_sent_height_per_timestamp_);
181 max_sent_width_per_timestamp_ = 0; 202 max_sent_width_per_timestamp_ = 0;
182 max_sent_height_per_timestamp_ = 0; 203 max_sent_height_per_timestamp_ = 0;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 319 }
299 320
300 int SendStatisticsProxy::BoolSampleCounter::Fraction( 321 int SendStatisticsProxy::BoolSampleCounter::Fraction(
301 int min_required_samples, float multiplier) const { 322 int min_required_samples, float multiplier) const {
302 if (num_samples < min_required_samples || num_samples == 0) 323 if (num_samples < min_required_samples || num_samples == 0)
303 return -1; 324 return -1;
304 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 325 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
305 } 326 }
306 327
307 } // namespace webrtc 328 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698