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

Side by Side Diff: webrtc/call/call.cc

Issue 2957073002: Add received audio and video call duration metrics based on packets. (Closed)
Patch Set: Add audio metric. Created 3 years, 5 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 | « no previous file | no next file » | 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 webrtc::RtcEventLog* event_log_; 319 webrtc::RtcEventLog* event_log_;
320 320
321 // The following members are only accessed (exclusively) from one thread and 321 // The following members are only accessed (exclusively) from one thread and
322 // from the destructor, and therefore doesn't need any explicit 322 // from the destructor, and therefore doesn't need any explicit
323 // synchronization. 323 // synchronization.
324 RateCounter received_bytes_per_second_counter_; 324 RateCounter received_bytes_per_second_counter_;
325 RateCounter received_audio_bytes_per_second_counter_; 325 RateCounter received_audio_bytes_per_second_counter_;
326 RateCounter received_video_bytes_per_second_counter_; 326 RateCounter received_video_bytes_per_second_counter_;
327 RateCounter received_rtcp_bytes_per_second_counter_; 327 RateCounter received_rtcp_bytes_per_second_counter_;
328 328
aleloi 2017/06/27 14:13:37 I think the rtp_audio_ms_ counters should be moved
329 // TODO(holmer): Remove this lock once BitrateController no longer calls 329 // TODO(holmer): Remove this lock once BitrateController no longer calls
330 // OnNetworkChanged from multiple threads. 330 // OnNetworkChanged from multiple threads.
331 rtc::CriticalSection bitrate_crit_; 331 rtc::CriticalSection bitrate_crit_;
332 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 332 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
333 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 333 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
334 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 334 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
335 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 335 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
336 336
337 std::map<std::string, rtc::NetworkRoute> network_routes_; 337 std::map<std::string, rtc::NetworkRoute> network_routes_;
338 338
339 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_; 339 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_;
340 ReceiveSideCongestionController receive_side_cc_; 340 ReceiveSideCongestionController receive_side_cc_;
341 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; 341 const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
342 const int64_t start_ms_; 342 const int64_t start_ms_;
343 int64_t first_received_rtp_audio_ms_ = -1;
344 int64_t last_received_rtp_audio_ms_ = -1;
aleloi 2017/06/27 14:13:37 There is a type rtc::Optional from webrtc/base/opt
345
343 // TODO(perkj): |worker_queue_| is supposed to replace 346 // TODO(perkj): |worker_queue_| is supposed to replace
344 // |module_process_thread_|. 347 // |module_process_thread_|.
345 // |worker_queue| is defined last to ensure all pending tasks are cancelled 348 // |worker_queue| is defined last to ensure all pending tasks are cancelled
346 // and deleted before any other members. 349 // and deleted before any other members.
347 rtc::TaskQueue worker_queue_; 350 rtc::TaskQueue worker_queue_;
348 351
349 // The config mask set by SetBitrateConfigMask. 352 // The config mask set by SetBitrateConfigMask.
350 // 0 <= min <= start <= max 353 // 0 <= min <= start <= max
351 Config::BitrateConfigMask bitrate_config_mask_; 354 Config::BitrateConfigMask bitrate_config_mask_;
352 355
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 pacer_bitrate_kbps_counter_.ProcessAndGetStats(); 526 pacer_bitrate_kbps_counter_.ProcessAndGetStats();
524 if (pacer_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) { 527 if (pacer_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) {
525 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps", 528 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.PacerBitrateInKbps",
526 pacer_bitrate_stats.average); 529 pacer_bitrate_stats.average);
527 LOG(LS_INFO) << "WebRTC.Call.PacerBitrateInKbps, " 530 LOG(LS_INFO) << "WebRTC.Call.PacerBitrateInKbps, "
528 << pacer_bitrate_stats.ToString(); 531 << pacer_bitrate_stats.ToString();
529 } 532 }
530 } 533 }
531 534
532 void Call::UpdateReceiveHistograms() { 535 void Call::UpdateReceiveHistograms() {
536 if (first_received_rtp_audio_ms_ != -1) {
537 RTC_HISTOGRAM_COUNTS_100000(
538 "WebRTC.Call.TimeReceivingAudioRtpPacketsInSeconds",
539 (last_received_rtp_audio_ms_ - first_received_rtp_audio_ms_) / 1000);
540 }
533 const int kMinRequiredPeriodicSamples = 5; 541 const int kMinRequiredPeriodicSamples = 5;
534 AggregatedStats video_bytes_per_sec = 542 AggregatedStats video_bytes_per_sec =
535 received_video_bytes_per_second_counter_.GetStats(); 543 received_video_bytes_per_second_counter_.GetStats();
536 if (video_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) { 544 if (video_bytes_per_sec.num_samples > kMinRequiredPeriodicSamples) {
537 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps", 545 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.VideoBitrateReceivedInKbps",
538 video_bytes_per_sec.average * 8 / 1000); 546 video_bytes_per_sec.average * 8 / 1000);
539 LOG(LS_INFO) << "WebRTC.Call.VideoBitrateReceivedInBps, " 547 LOG(LS_INFO) << "WebRTC.Call.VideoBitrateReceivedInBps, "
540 << video_bytes_per_sec.ToStringWithMultiplier(8); 548 << video_bytes_per_sec.ToStringWithMultiplier(8);
541 } 549 }
542 AggregatedStats audio_bytes_per_sec = 550 AggregatedStats audio_bytes_per_sec =
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 } 1318 }
1311 parsed_packet->IdentifyExtensions(it->second.extensions); 1319 parsed_packet->IdentifyExtensions(it->second.extensions);
1312 1320
1313 NotifyBweOfReceivedPacket(*parsed_packet, media_type); 1321 NotifyBweOfReceivedPacket(*parsed_packet, media_type);
1314 1322
1315 if (media_type == MediaType::AUDIO) { 1323 if (media_type == MediaType::AUDIO) {
1316 if (audio_receiver_controller.OnRtpPacket(*parsed_packet)) { 1324 if (audio_receiver_controller.OnRtpPacket(*parsed_packet)) {
1317 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1325 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1318 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length)); 1326 received_audio_bytes_per_second_counter_.Add(static_cast<int>(length));
1319 event_log_->LogRtpHeader(kIncomingPacket, packet, length); 1327 event_log_->LogRtpHeader(kIncomingPacket, packet, length);
1328 if (first_received_rtp_audio_ms_ == -1)
1329 first_received_rtp_audio_ms_ = packet_time.timestamp;
aleloi 2017/06/27 14:13:37 Other places in this file use brackets for single
saza WebRTC 2017/06/29 11:49:05 Ok, I'll add them (for safety, if nothing else). T
1330 last_received_rtp_audio_ms_ = packet_time.timestamp;
1320 return DELIVERY_OK; 1331 return DELIVERY_OK;
1321 } 1332 }
1322 } else if (media_type == MediaType::VIDEO) { 1333 } else if (media_type == MediaType::VIDEO) {
1323 if (video_receiver_controller.OnRtpPacket(*parsed_packet)) { 1334 if (video_receiver_controller.OnRtpPacket(*parsed_packet)) {
1324 received_bytes_per_second_counter_.Add(static_cast<int>(length)); 1335 received_bytes_per_second_counter_.Add(static_cast<int>(length));
1325 received_video_bytes_per_second_counter_.Add(static_cast<int>(length)); 1336 received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
1326 event_log_->LogRtpHeader(kIncomingPacket, packet, length); 1337 event_log_->LogRtpHeader(kIncomingPacket, packet, length);
1327 return DELIVERY_OK; 1338 return DELIVERY_OK;
1328 } 1339 }
1329 } 1340 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1394 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1384 receive_side_cc_.OnReceivedPacket( 1395 receive_side_cc_.OnReceivedPacket(
1385 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1396 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1386 header); 1397 header);
1387 } 1398 }
1388 } 1399 }
1389 1400
1390 } // namespace internal 1401 } // namespace internal
1391 1402
1392 } // namespace webrtc 1403 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698