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_sent_frame_counter_.Percent(kMinRequiredSamples); | |
stefan-webrtc
2015/09/16 07:36:57
I think "sent" is implied here and that you can le
åsapersson
2015/09/17 14:24:45
Done.
| |
68 if (quality_limited != -1) { | |
69 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.QualityLimitedResolutionInPercent", | |
70 quality_limited); | |
71 } | |
65 } | 72 } |
66 | 73 |
67 void SendStatisticsProxy::OutgoingRate(const int video_channel, | 74 void SendStatisticsProxy::OutgoingRate(const int video_channel, |
68 const unsigned int framerate, | 75 const unsigned int framerate, |
69 const unsigned int bitrate) { | 76 const unsigned int bitrate) { |
70 rtc::CritScope lock(&crit_); | 77 rtc::CritScope lock(&crit_); |
71 stats_.encode_frame_rate = framerate; | 78 stats_.encode_frame_rate = framerate; |
72 stats_.media_bitrate_bps = bitrate; | 79 stats_.media_bitrate_bps = bitrate; |
73 } | 80 } |
74 | 81 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 162 |
156 rtc::CritScope lock(&crit_); | 163 rtc::CritScope lock(&crit_); |
157 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 164 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
158 if (stats == nullptr) | 165 if (stats == nullptr) |
159 return; | 166 return; |
160 | 167 |
161 stats->width = encoded_image._encodedWidth; | 168 stats->width = encoded_image._encodedWidth; |
162 stats->height = encoded_image._encodedHeight; | 169 stats->height = encoded_image._encodedHeight; |
163 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 170 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
164 | 171 |
172 if (encoded_image._length > 0) { | |
173 if (encoded_image.adapt_reason_.quality_limited_resolution_available) { | |
174 quality_limited_sent_frame_counter_.Add( | |
175 encoded_image.adapt_reason_.quality_limited_resolution); | |
176 } | |
177 } | |
178 | |
165 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 179 // 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 | 180 // different threads and there is no guarantee that one frame of all layers |
167 // are encoded before the next start. | 181 // are encoded before the next start. |
168 if (last_sent_frame_timestamp_ > 0 && | 182 if (last_sent_frame_timestamp_ > 0 && |
169 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 183 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
170 sent_frame_rate_tracker_total_.Update(1); | 184 sent_frame_rate_tracker_total_.Update(1); |
171 sent_width_counter_.Add(max_sent_width_per_timestamp_); | 185 sent_width_counter_.Add(max_sent_width_per_timestamp_); |
172 sent_height_counter_.Add(max_sent_height_per_timestamp_); | 186 sent_height_counter_.Add(max_sent_height_per_timestamp_); |
173 max_sent_width_per_timestamp_ = 0; | 187 max_sent_width_per_timestamp_ = 0; |
174 max_sent_height_per_timestamp_ = 0; | 188 max_sent_height_per_timestamp_ = 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 sum += sample; | 281 sum += sample; |
268 ++num_samples; | 282 ++num_samples; |
269 } | 283 } |
270 | 284 |
271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 285 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
272 if (num_samples < min_required_samples || num_samples == 0) | 286 if (num_samples < min_required_samples || num_samples == 0) |
273 return -1; | 287 return -1; |
274 return sum / num_samples; | 288 return sum / num_samples; |
275 } | 289 } |
276 | 290 |
291 void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) { | |
292 if (sample) | |
293 ++sum; | |
294 ++num_samples; | |
295 } | |
296 | |
297 int SendStatisticsProxy::BoolSampleCounter::Percent( | |
298 int min_required_samples) const { | |
299 if (num_samples < min_required_samples || num_samples == 0) | |
300 return -1; | |
301 return sum * 100 / num_samples; | |
302 } | |
277 } // namespace webrtc | 303 } // namespace webrtc |
OLD | NEW |