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 28 matching lines...) Expand all Loading... | |
39 #include "webrtc/rtc_base/basictypes.h" | 39 #include "webrtc/rtc_base/basictypes.h" |
40 #include "webrtc/rtc_base/checks.h" | 40 #include "webrtc/rtc_base/checks.h" |
41 #include "webrtc/rtc_base/constructormagic.h" | 41 #include "webrtc/rtc_base/constructormagic.h" |
42 #include "webrtc/rtc_base/location.h" | 42 #include "webrtc/rtc_base/location.h" |
43 #include "webrtc/rtc_base/logging.h" | 43 #include "webrtc/rtc_base/logging.h" |
44 #include "webrtc/rtc_base/optional.h" | 44 #include "webrtc/rtc_base/optional.h" |
45 #include "webrtc/rtc_base/ptr_util.h" | 45 #include "webrtc/rtc_base/ptr_util.h" |
46 #include "webrtc/rtc_base/task_queue.h" | 46 #include "webrtc/rtc_base/task_queue.h" |
47 #include "webrtc/rtc_base/thread_annotations.h" | 47 #include "webrtc/rtc_base/thread_annotations.h" |
48 #include "webrtc/rtc_base/thread_checker.h" | 48 #include "webrtc/rtc_base/thread_checker.h" |
49 #include "webrtc/rtc_base/time_interval.h" | |
49 #include "webrtc/rtc_base/trace_event.h" | 50 #include "webrtc/rtc_base/trace_event.h" |
50 #include "webrtc/system_wrappers/include/clock.h" | 51 #include "webrtc/system_wrappers/include/clock.h" |
51 #include "webrtc/system_wrappers/include/cpu_info.h" | 52 #include "webrtc/system_wrappers/include/cpu_info.h" |
52 #include "webrtc/system_wrappers/include/metrics.h" | 53 #include "webrtc/system_wrappers/include/metrics.h" |
53 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 54 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
54 #include "webrtc/system_wrappers/include/trace.h" | 55 #include "webrtc/system_wrappers/include/trace.h" |
55 #include "webrtc/video/call_stats.h" | 56 #include "webrtc/video/call_stats.h" |
56 #include "webrtc/video/send_delay_stats.h" | 57 #include "webrtc/video/send_delay_stats.h" |
57 #include "webrtc/video/stats_counter.h" | 58 #include "webrtc/video/stats_counter.h" |
58 #include "webrtc/video/video_receive_stream.h" | 59 #include "webrtc/video/video_receive_stream.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 // from the destructor, and therefore doesn't need any explicit | 323 // from the destructor, and therefore doesn't need any explicit |
323 // synchronization. | 324 // synchronization. |
324 RateCounter received_bytes_per_second_counter_; | 325 RateCounter received_bytes_per_second_counter_; |
325 RateCounter received_audio_bytes_per_second_counter_; | 326 RateCounter received_audio_bytes_per_second_counter_; |
326 RateCounter received_video_bytes_per_second_counter_; | 327 RateCounter received_video_bytes_per_second_counter_; |
327 RateCounter received_rtcp_bytes_per_second_counter_; | 328 RateCounter received_rtcp_bytes_per_second_counter_; |
328 rtc::Optional<int64_t> first_received_rtp_audio_ms_; | 329 rtc::Optional<int64_t> first_received_rtp_audio_ms_; |
329 rtc::Optional<int64_t> last_received_rtp_audio_ms_; | 330 rtc::Optional<int64_t> last_received_rtp_audio_ms_; |
330 rtc::Optional<int64_t> first_received_rtp_video_ms_; | 331 rtc::Optional<int64_t> first_received_rtp_video_ms_; |
331 rtc::Optional<int64_t> last_received_rtp_video_ms_; | 332 rtc::Optional<int64_t> last_received_rtp_video_ms_; |
333 rtc::TimeInterval sent_rtp_audio_timer_ms_; | |
332 | 334 |
333 // TODO(holmer): Remove this lock once BitrateController no longer calls | 335 // TODO(holmer): Remove this lock once BitrateController no longer calls |
334 // OnNetworkChanged from multiple threads. | 336 // OnNetworkChanged from multiple threads. |
335 rtc::CriticalSection bitrate_crit_; | 337 rtc::CriticalSection bitrate_crit_; |
336 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 338 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
337 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 339 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); |
338 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 340 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); |
339 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 341 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); |
340 | 342 |
341 std::map<std::string, rtc::NetworkRoute> network_routes_; | 343 std::map<std::string, rtc::NetworkRoute> network_routes_; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 | 505 |
504 void Call::UpdateHistograms() { | 506 void Call::UpdateHistograms() { |
505 RTC_HISTOGRAM_COUNTS_100000( | 507 RTC_HISTOGRAM_COUNTS_100000( |
506 "WebRTC.Call.LifetimeInSeconds", | 508 "WebRTC.Call.LifetimeInSeconds", |
507 (clock_->TimeInMilliseconds() - start_ms_) / 1000); | 509 (clock_->TimeInMilliseconds() - start_ms_) / 1000); |
508 } | 510 } |
509 | 511 |
510 void Call::UpdateSendHistograms(int64_t first_sent_packet_ms) { | 512 void Call::UpdateSendHistograms(int64_t first_sent_packet_ms) { |
511 if (first_sent_packet_ms == -1) | 513 if (first_sent_packet_ms == -1) |
512 return; | 514 return; |
515 if (!sent_rtp_audio_timer_ms_.Empty()) { | |
516 RTC_HISTOGRAM_COUNTS_100000( | |
pbos-webrtc
2017/07/13 16:59:45
Is this code actually intending to track sent RTP
| |
517 "WebRTC.Call.TimeSendingAudioRtpPacketsInSeconds", | |
518 (*sent_rtp_audio_timer_ms_.Last() - *sent_rtp_audio_timer_ms_.First()) / | |
519 1000); | |
520 } | |
513 int64_t elapsed_sec = | 521 int64_t elapsed_sec = |
514 (clock_->TimeInMilliseconds() - first_sent_packet_ms) / 1000; | 522 (clock_->TimeInMilliseconds() - first_sent_packet_ms) / 1000; |
515 if (elapsed_sec < metrics::kMinRunTimeInSeconds) | 523 if (elapsed_sec < metrics::kMinRunTimeInSeconds) |
516 return; | 524 return; |
517 const int kMinRequiredPeriodicSamples = 5; | 525 const int kMinRequiredPeriodicSamples = 5; |
518 AggregatedStats send_bitrate_stats = | 526 AggregatedStats send_bitrate_stats = |
519 estimated_send_bitrate_kbps_counter_.ProcessAndGetStats(); | 527 estimated_send_bitrate_kbps_counter_.ProcessAndGetStats(); |
520 if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) { | 528 if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) { |
521 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", | 529 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", |
522 send_bitrate_stats.average); | 530 send_bitrate_stats.average); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 } | 649 } |
642 { | 650 { |
643 ReadLockScoped read_lock(*receive_crit_); | 651 ReadLockScoped read_lock(*receive_crit_); |
644 for (AudioReceiveStream* stream : audio_receive_streams_) { | 652 for (AudioReceiveStream* stream : audio_receive_streams_) { |
645 if (stream->config().rtp.local_ssrc == ssrc) { | 653 if (stream->config().rtp.local_ssrc == ssrc) { |
646 stream->AssociateSendStream(nullptr); | 654 stream->AssociateSendStream(nullptr); |
647 } | 655 } |
648 } | 656 } |
649 } | 657 } |
650 UpdateAggregateNetworkState(); | 658 UpdateAggregateNetworkState(); |
659 const rtc::TimeInterval* stream_active_lifetime = | |
660 audio_send_stream->GetActiveLifetime(); | |
661 if (!stream_active_lifetime->Empty()) { | |
662 sent_rtp_audio_timer_ms_.Extend(*stream_active_lifetime->First()); | |
663 sent_rtp_audio_timer_ms_.Extend(*stream_active_lifetime->Last()); | |
664 } | |
651 delete audio_send_stream; | 665 delete audio_send_stream; |
652 } | 666 } |
653 | 667 |
654 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 668 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
655 const webrtc::AudioReceiveStream::Config& config) { | 669 const webrtc::AudioReceiveStream::Config& config) { |
656 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 670 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
657 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 671 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
658 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 672 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
659 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 673 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
660 &audio_receiver_controller_, transport_send_->packet_router(), config, | 674 &audio_receiver_controller_, transport_send_->packet_router(), config, |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1415 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1429 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1416 receive_side_cc_.OnReceivedPacket( | 1430 receive_side_cc_.OnReceivedPacket( |
1417 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1431 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1418 header); | 1432 header); |
1419 } | 1433 } |
1420 } | 1434 } |
1421 | 1435 |
1422 } // namespace internal | 1436 } // namespace internal |
1423 | 1437 |
1424 } // namespace webrtc | 1438 } // namespace webrtc |
OLD | NEW |