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

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

Issue 1264693003: Add QP stats for sent video streams to StatsReport. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: added comment Created 5 years, 3 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
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 for (const auto& it : qp_counters_) {
67 int qp = it.second.vp8.Avg(kMinRequiredSamples);
68 if (qp != -1)
69 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.Vp8.Qp", qp);
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
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.qp_ != -1 && encoded_image._length > 0) {
172 if (rtp_video_header->codec == kRtpVideoVp8) {
173 qp_counters_[ssrc].vp8.Add(encoded_image.qp_);
174 }
175 }
176
165 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 177 // 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 178 // different threads and there is no guarantee that one frame of all layers
167 // are encoded before the next start. 179 // are encoded before the next start.
168 if (last_sent_frame_timestamp_ > 0 && 180 if (last_sent_frame_timestamp_ > 0 &&
169 encoded_image._timeStamp != last_sent_frame_timestamp_) { 181 encoded_image._timeStamp != last_sent_frame_timestamp_) {
170 sent_frame_rate_tracker_total_.Update(1); 182 sent_frame_rate_tracker_total_.Update(1);
171 sent_width_counter_.Add(max_sent_width_per_timestamp_); 183 sent_width_counter_.Add(max_sent_width_per_timestamp_);
172 sent_height_counter_.Add(max_sent_height_per_timestamp_); 184 sent_height_counter_.Add(max_sent_height_per_timestamp_);
173 max_sent_width_per_timestamp_ = 0; 185 max_sent_width_per_timestamp_ = 0;
174 max_sent_height_per_timestamp_ = 0; 186 max_sent_height_per_timestamp_ = 0;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ++num_samples; 280 ++num_samples;
269 } 281 }
270 282
271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 283 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
272 if (num_samples < min_required_samples || num_samples == 0) 284 if (num_samples < min_required_samples || num_samples == 0)
273 return -1; 285 return -1;
274 return sum / num_samples; 286 return sum / num_samples;
275 } 287 }
276 288
277 } // namespace webrtc 289 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698