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

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

Issue 1530913002: Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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.cc ('k') | webrtc/video/vie_receiver.cc » ('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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 void ViEChannel::UpdateHistograms() { 196 void ViEChannel::UpdateHistograms() {
197 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); 197 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
198 198
199 { 199 {
200 CriticalSectionScoped cs(crit_.get()); 200 CriticalSectionScoped cs(crit_.get());
201 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000; 201 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000;
202 if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 && 202 if (time_of_first_rtt_ms_ != -1 && num_rtts_ > 0 &&
203 elapsed_sec > metrics::kMinRunTimeInSeconds) { 203 elapsed_sec > metrics::kMinRunTimeInSeconds) {
204 int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_; 204 int64_t avg_rtt_ms = (rtt_sum_ms_ + num_rtts_ / 2) / num_rtts_;
205 RTC_HISTOGRAM_COUNTS_10000( 205 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
206 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); 206 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
207 } 207 }
208 } 208 }
209 209
210 if (sender_) { 210 if (sender_) {
211 RtcpPacketTypeCounter rtcp_counter; 211 RtcpPacketTypeCounter rtcp_counter;
212 GetSendRtcpPacketTypeCounter(&rtcp_counter); 212 GetSendRtcpPacketTypeCounter(&rtcp_counter);
213 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; 213 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
214 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 214 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
215 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute", 215 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
216 rtcp_counter.nack_packets * 60 / elapsed_sec); 216 "WebRTC.Video.NackPacketsReceivedPerMinute",
217 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", 217 rtcp_counter.nack_packets * 60 / elapsed_sec);
218 rtcp_counter.fir_packets * 60 / elapsed_sec); 218 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
219 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", 219 "WebRTC.Video.FirPacketsReceivedPerMinute",
220 rtcp_counter.pli_packets * 60 / elapsed_sec); 220 rtcp_counter.fir_packets * 60 / elapsed_sec);
221 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
222 "WebRTC.Video.PliPacketsReceivedPerMinute",
223 rtcp_counter.pli_packets * 60 / elapsed_sec);
221 if (rtcp_counter.nack_requests > 0) { 224 if (rtcp_counter.nack_requests > 0) {
222 RTC_HISTOGRAM_PERCENTAGE( 225 RTC_HISTOGRAM_PERCENTAGE_SPARSE(
223 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", 226 "WebRTC.Video.UniqueNackRequestsReceivedInPercent",
224 rtcp_counter.UniqueNackRequestsInPercent()); 227 rtcp_counter.UniqueNackRequestsInPercent());
225 } 228 }
226 int fraction_lost = report_block_stats_sender_->FractionLostInPercent(); 229 int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
227 if (fraction_lost != -1) { 230 if (fraction_lost != -1) {
228 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent", 231 RTC_HISTOGRAM_PERCENTAGE_SPARSE("WebRTC.Video.SentPacketsLostInPercent",
229 fraction_lost); 232 fraction_lost);
230 } 233 }
231 } 234 }
232 235
233 StreamDataCounters rtp; 236 StreamDataCounters rtp;
234 StreamDataCounters rtx; 237 StreamDataCounters rtx;
235 GetSendStreamDataCounters(&rtp, &rtx); 238 GetSendStreamDataCounters(&rtp, &rtx);
236 StreamDataCounters rtp_rtx = rtp; 239 StreamDataCounters rtp_rtx = rtp;
237 rtp_rtx.Add(rtx); 240 rtp_rtx.Add(rtx);
238 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( 241 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
239 Clock::GetRealTimeClock()->TimeInMilliseconds()) / 242 Clock::GetRealTimeClock()->TimeInMilliseconds()) /
240 1000; 243 1000;
241 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 244 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
242 RTC_HISTOGRAM_COUNTS_100000( 245 RTC_HISTOGRAM_COUNTS_SPARSE_100000(
243 "WebRTC.Video.BitrateSentInKbps", 246 "WebRTC.Video.BitrateSentInKbps",
244 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 247 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
245 1000)); 248 1000));
246 RTC_HISTOGRAM_COUNTS_10000( 249 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
247 "WebRTC.Video.MediaBitrateSentInKbps", 250 "WebRTC.Video.MediaBitrateSentInKbps",
248 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); 251 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
249 RTC_HISTOGRAM_COUNTS_10000( 252 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
250 "WebRTC.Video.PaddingBitrateSentInKbps", 253 "WebRTC.Video.PaddingBitrateSentInKbps",
251 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 254 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
252 1000)); 255 1000));
253 RTC_HISTOGRAM_COUNTS_10000( 256 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
254 "WebRTC.Video.RetransmittedBitrateSentInKbps", 257 "WebRTC.Video.RetransmittedBitrateSentInKbps",
255 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / 258 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
256 elapsed_sec / 1000)); 259 elapsed_sec / 1000));
257 if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) { 260 if (rtp_rtcp_modules_[0]->RtxSendStatus() != kRtxOff) {
258 RTC_HISTOGRAM_COUNTS_10000( 261 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
259 "WebRTC.Video.RtxBitrateSentInKbps", 262 "WebRTC.Video.RtxBitrateSentInKbps",
260 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 263 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
261 1000)); 264 1000));
262 } 265 }
263 bool fec_enabled = false; 266 bool fec_enabled = false;
264 uint8_t pltype_red; 267 uint8_t pltype_red;
265 uint8_t pltype_fec; 268 uint8_t pltype_fec;
266 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, 269 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red,
267 &pltype_fec); 270 &pltype_fec);
268 if (fec_enabled) { 271 if (fec_enabled) {
269 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", 272 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
270 static_cast<int>(rtp_rtx.fec.TotalBytes() * 273 "WebRTC.Video.FecBitrateSentInKbps",
271 8 / elapsed_sec / 1000)); 274 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
275 1000));
272 } 276 }
273 } 277 }
274 } else if (vie_receiver_.GetRemoteSsrc() > 0) { 278 } else if (vie_receiver_.GetRemoteSsrc() > 0) {
275 // Get receive stats if we are receiving packets, i.e. there is a remote 279 // Get receive stats if we are receiving packets, i.e. there is a remote
276 // ssrc. 280 // ssrc.
277 RtcpPacketTypeCounter rtcp_counter; 281 RtcpPacketTypeCounter rtcp_counter;
278 GetReceiveRtcpPacketTypeCounter(&rtcp_counter); 282 GetReceiveRtcpPacketTypeCounter(&rtcp_counter);
279 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; 283 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
280 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 284 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
281 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", 285 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
286 "WebRTC.Video.NackPacketsSentPerMinute",
282 rtcp_counter.nack_packets * 60 / elapsed_sec); 287 rtcp_counter.nack_packets * 60 / elapsed_sec);
283 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", 288 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
289 "WebRTC.Video.FirPacketsSentPerMinute",
284 rtcp_counter.fir_packets * 60 / elapsed_sec); 290 rtcp_counter.fir_packets * 60 / elapsed_sec);
285 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", 291 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
292 "WebRTC.Video.PliPacketsSentPerMinute",
286 rtcp_counter.pli_packets * 60 / elapsed_sec); 293 rtcp_counter.pli_packets * 60 / elapsed_sec);
287 if (rtcp_counter.nack_requests > 0) { 294 if (rtcp_counter.nack_requests > 0) {
288 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", 295 RTC_HISTOGRAM_PERCENTAGE_SPARSE(
296 "WebRTC.Video.UniqueNackRequestsSentInPercent",
289 rtcp_counter.UniqueNackRequestsInPercent()); 297 rtcp_counter.UniqueNackRequestsInPercent());
290 } 298 }
291 } 299 }
292 300
293 StreamDataCounters rtp; 301 StreamDataCounters rtp;
294 StreamDataCounters rtx; 302 StreamDataCounters rtx;
295 GetReceiveStreamDataCounters(&rtp, &rtx); 303 GetReceiveStreamDataCounters(&rtp, &rtx);
296 StreamDataCounters rtp_rtx = rtp; 304 StreamDataCounters rtp_rtx = rtp;
297 rtp_rtx.Add(rtx); 305 rtp_rtx.Add(rtx);
298 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; 306 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000;
299 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 307 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
300 RTC_HISTOGRAM_COUNTS_10000( 308 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
301 "WebRTC.Video.BitrateReceivedInKbps", 309 "WebRTC.Video.BitrateReceivedInKbps",
302 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 310 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
303 1000)); 311 1000));
304 RTC_HISTOGRAM_COUNTS_10000( 312 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
305 "WebRTC.Video.MediaBitrateReceivedInKbps", 313 "WebRTC.Video.MediaBitrateReceivedInKbps",
306 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); 314 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
307 RTC_HISTOGRAM_COUNTS_10000( 315 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
308 "WebRTC.Video.PaddingBitrateReceivedInKbps", 316 "WebRTC.Video.PaddingBitrateReceivedInKbps",
309 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 317 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
310 1000)); 318 1000));
311 RTC_HISTOGRAM_COUNTS_10000( 319 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
312 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", 320 "WebRTC.Video.RetransmittedBitrateReceivedInKbps",
313 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / 321 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
314 elapsed_sec / 1000)); 322 elapsed_sec / 1000));
315 uint32_t ssrc = 0; 323 uint32_t ssrc = 0;
316 if (vie_receiver_.GetRtxSsrc(&ssrc)) { 324 if (vie_receiver_.GetRtxSsrc(&ssrc)) {
317 RTC_HISTOGRAM_COUNTS_10000( 325 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
318 "WebRTC.Video.RtxBitrateReceivedInKbps", 326 "WebRTC.Video.RtxBitrateReceivedInKbps",
319 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 327 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
320 1000)); 328 1000));
321 } 329 }
322 if (vie_receiver_.IsFecEnabled()) { 330 if (vie_receiver_.IsFecEnabled()) {
323 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps", 331 RTC_HISTOGRAM_COUNTS_SPARSE_10000(
324 static_cast<int>(rtp_rtx.fec.TotalBytes() * 332 "WebRTC.Video.FecBitrateReceivedInKbps",
325 8 / elapsed_sec / 1000)); 333 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec /
334 1000));
326 } 335 }
327 } 336 }
328 } 337 }
329 } 338 }
330 339
331 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, 340 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
332 bool new_stream) { 341 bool new_stream) {
333 RTC_DCHECK(sender_); 342 RTC_DCHECK(sender_);
334 if (video_codec.codecType == kVideoCodecRED || 343 if (video_codec.codecType == kVideoCodecRED ||
335 video_codec.codecType == kVideoCodecULPFEC) { 344 video_codec.codecType == kVideoCodecULPFEC) {
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 CriticalSectionScoped cs(crit_.get()); 1203 CriticalSectionScoped cs(crit_.get());
1195 receive_stats_callback_ = receive_statistics_proxy; 1204 receive_stats_callback_ = receive_statistics_proxy;
1196 } 1205 }
1197 1206
1198 void ViEChannel::SetIncomingVideoStream( 1207 void ViEChannel::SetIncomingVideoStream(
1199 IncomingVideoStream* incoming_video_stream) { 1208 IncomingVideoStream* incoming_video_stream) {
1200 CriticalSectionScoped cs(crit_.get()); 1209 CriticalSectionScoped cs(crit_.get());
1201 incoming_video_stream_ = incoming_video_stream; 1210 incoming_video_stream_ = incoming_video_stream;
1202 } 1211 }
1203 } // namespace webrtc 1212 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.cc ('k') | webrtc/video/vie_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698