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 |
11 #include <string.h> | 11 #include <string.h> |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <map> | 13 #include <map> |
14 #include <memory> | 14 #include <memory> |
15 #include <set> | 15 #include <set> |
16 #include <utility> | 16 #include <utility> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/audio/audio_receive_stream.h" | 19 #include "webrtc/audio/audio_receive_stream.h" |
20 #include "webrtc/audio/audio_send_stream.h" | 20 #include "webrtc/audio/audio_send_stream.h" |
21 #include "webrtc/audio/audio_state.h" | 21 #include "webrtc/audio/audio_state.h" |
22 #include "webrtc/audio/scoped_voe_interface.h" | 22 #include "webrtc/audio/scoped_voe_interface.h" |
| 23 #include "webrtc/audio/time_interval.h" |
23 #include "webrtc/call/bitrate_allocator.h" | 24 #include "webrtc/call/bitrate_allocator.h" |
24 #include "webrtc/call/call.h" | 25 #include "webrtc/call/call.h" |
25 #include "webrtc/call/flexfec_receive_stream_impl.h" | 26 #include "webrtc/call/flexfec_receive_stream_impl.h" |
26 #include "webrtc/call/rtp_stream_receiver_controller.h" | 27 #include "webrtc/call/rtp_stream_receiver_controller.h" |
27 #include "webrtc/call/rtp_transport_controller_send.h" | 28 #include "webrtc/call/rtp_transport_controller_send.h" |
28 #include "webrtc/config.h" | 29 #include "webrtc/config.h" |
29 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
30 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 31 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
31 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c
ontroller.h" | 32 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c
ontroller.h" |
32 #include "webrtc/modules/pacing/paced_sender.h" | 33 #include "webrtc/modules/pacing/paced_sender.h" |
(...skipping 289 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 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( |
| 517 "WebRTC.Call.TimeSendingAudioRtpPacketsInSeconds", |
| 518 sent_rtp_audio_timer_ms_.Length() / 1000); |
| 519 } |
513 int64_t elapsed_sec = | 520 int64_t elapsed_sec = |
514 (clock_->TimeInMilliseconds() - first_sent_packet_ms) / 1000; | 521 (clock_->TimeInMilliseconds() - first_sent_packet_ms) / 1000; |
515 if (elapsed_sec < metrics::kMinRunTimeInSeconds) | 522 if (elapsed_sec < metrics::kMinRunTimeInSeconds) |
516 return; | 523 return; |
517 const int kMinRequiredPeriodicSamples = 5; | 524 const int kMinRequiredPeriodicSamples = 5; |
518 AggregatedStats send_bitrate_stats = | 525 AggregatedStats send_bitrate_stats = |
519 estimated_send_bitrate_kbps_counter_.ProcessAndGetStats(); | 526 estimated_send_bitrate_kbps_counter_.ProcessAndGetStats(); |
520 if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) { | 527 if (send_bitrate_stats.num_samples > kMinRequiredPeriodicSamples) { |
521 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", | 528 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Call.EstimatedSendBitrateInKbps", |
522 send_bitrate_stats.average); | 529 send_bitrate_stats.average); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 648 } |
642 { | 649 { |
643 ReadLockScoped read_lock(*receive_crit_); | 650 ReadLockScoped read_lock(*receive_crit_); |
644 for (AudioReceiveStream* stream : audio_receive_streams_) { | 651 for (AudioReceiveStream* stream : audio_receive_streams_) { |
645 if (stream->config().rtp.local_ssrc == ssrc) { | 652 if (stream->config().rtp.local_ssrc == ssrc) { |
646 stream->AssociateSendStream(nullptr); | 653 stream->AssociateSendStream(nullptr); |
647 } | 654 } |
648 } | 655 } |
649 } | 656 } |
650 UpdateAggregateNetworkState(); | 657 UpdateAggregateNetworkState(); |
| 658 sent_rtp_audio_timer_ms_.Extend(audio_send_stream->GetActiveLifetime()); |
651 delete audio_send_stream; | 659 delete audio_send_stream; |
652 } | 660 } |
653 | 661 |
654 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 662 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
655 const webrtc::AudioReceiveStream::Config& config) { | 663 const webrtc::AudioReceiveStream::Config& config) { |
656 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 664 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
657 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); | 665 RTC_DCHECK_RUN_ON(&configuration_thread_checker_); |
658 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); | 666 event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config)); |
659 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 667 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
660 &audio_receiver_controller_, transport_send_->packet_router(), config, | 668 &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)) { | 1423 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1416 receive_side_cc_.OnReceivedPacket( | 1424 receive_side_cc_.OnReceivedPacket( |
1417 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1425 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1418 header); | 1426 header); |
1419 } | 1427 } |
1420 } | 1428 } |
1421 | 1429 |
1422 } // namespace internal | 1430 } // namespace internal |
1423 | 1431 |
1424 } // namespace webrtc | 1432 } // namespace webrtc |
OLD | NEW |