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 12 matching lines...) Expand all Loading... |
23 #include "webrtc/audio/time_interval.h" | 23 #include "webrtc/audio/time_interval.h" |
24 #include "webrtc/call/bitrate_allocator.h" | 24 #include "webrtc/call/bitrate_allocator.h" |
25 #include "webrtc/call/call.h" | 25 #include "webrtc/call/call.h" |
26 #include "webrtc/call/flexfec_receive_stream_impl.h" | 26 #include "webrtc/call/flexfec_receive_stream_impl.h" |
27 #include "webrtc/call/rtp_stream_receiver_controller.h" | 27 #include "webrtc/call/rtp_stream_receiver_controller.h" |
28 #include "webrtc/call/rtp_transport_controller_send.h" | 28 #include "webrtc/call/rtp_transport_controller_send.h" |
29 #include "webrtc/config.h" | 29 #include "webrtc/config.h" |
30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 30 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
31 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 31 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
32 #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" |
33 #include "webrtc/modules/pacing/paced_sender.h" | |
34 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 33 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" | 34 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" |
36 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
37 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 36 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
38 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
39 #include "webrtc/modules/utility/include/process_thread.h" | 38 #include "webrtc/modules/utility/include/process_thread.h" |
40 #include "webrtc/rtc_base/basictypes.h" | 39 #include "webrtc/rtc_base/basictypes.h" |
41 #include "webrtc/rtc_base/checks.h" | 40 #include "webrtc/rtc_base/checks.h" |
42 #include "webrtc/rtc_base/constructormagic.h" | 41 #include "webrtc/rtc_base/constructormagic.h" |
43 #include "webrtc/rtc_base/location.h" | 42 #include "webrtc/rtc_base/location.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 transport_send_->send_side_cc()->SetBweBitrates( | 430 transport_send_->send_side_cc()->SetBweBitrates( |
432 config_.bitrate_config.min_bitrate_bps, | 431 config_.bitrate_config.min_bitrate_bps, |
433 config_.bitrate_config.start_bitrate_bps, | 432 config_.bitrate_config.start_bitrate_bps, |
434 config_.bitrate_config.max_bitrate_bps); | 433 config_.bitrate_config.max_bitrate_bps); |
435 call_stats_->RegisterStatsObserver(&receive_side_cc_); | 434 call_stats_->RegisterStatsObserver(&receive_side_cc_); |
436 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc()); | 435 call_stats_->RegisterStatsObserver(transport_send_->send_side_cc()); |
437 | 436 |
438 // We have to attach the pacer to the pacer thread before starting the | 437 // We have to attach the pacer to the pacer thread before starting the |
439 // module process thread to avoid a race accessing the process thread | 438 // module process thread to avoid a race accessing the process thread |
440 // both from the process thread and the pacer thread. | 439 // both from the process thread and the pacer thread. |
441 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), | 440 pacer_thread_->RegisterModule(transport_send_->pacer(), RTC_FROM_HERE); |
442 RTC_FROM_HERE); | |
443 pacer_thread_->RegisterModule( | 441 pacer_thread_->RegisterModule( |
444 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); | 442 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); |
445 pacer_thread_->Start(); | 443 pacer_thread_->Start(); |
446 | 444 |
447 module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE); | 445 module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE); |
448 module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE); | 446 module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE); |
449 module_process_thread_->RegisterModule(transport_send_->send_side_cc(), | 447 module_process_thread_->RegisterModule(transport_send_->send_side_cc(), |
450 RTC_FROM_HERE); | 448 RTC_FROM_HERE); |
451 module_process_thread_->Start(); | 449 module_process_thread_->Start(); |
452 } | 450 } |
453 | 451 |
454 Call::~Call() { | 452 Call::~Call() { |
455 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); | 453 RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_); |
456 | 454 |
457 RTC_CHECK(audio_send_ssrcs_.empty()); | 455 RTC_CHECK(audio_send_ssrcs_.empty()); |
458 RTC_CHECK(video_send_ssrcs_.empty()); | 456 RTC_CHECK(video_send_ssrcs_.empty()); |
459 RTC_CHECK(video_send_streams_.empty()); | 457 RTC_CHECK(video_send_streams_.empty()); |
460 RTC_CHECK(audio_receive_streams_.empty()); | 458 RTC_CHECK(audio_receive_streams_.empty()); |
461 RTC_CHECK(video_receive_streams_.empty()); | 459 RTC_CHECK(video_receive_streams_.empty()); |
462 | 460 |
463 // The send-side congestion controller must be de-registered prior to | 461 // The send-side congestion controller must be de-registered prior to |
464 // the pacer thread being stopped to avoid a race when accessing the | 462 // the pacer thread being stopped to avoid a race when accessing the |
465 // pacer thread object on the module process thread at the same time as | 463 // pacer thread object on the module process thread at the same time as |
466 // the pacer thread is stopped. | 464 // the pacer thread is stopped. |
467 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); | 465 module_process_thread_->DeRegisterModule(transport_send_->send_side_cc()); |
468 pacer_thread_->Stop(); | 466 pacer_thread_->Stop(); |
469 pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer()); | 467 pacer_thread_->DeRegisterModule(transport_send_->pacer()); |
470 pacer_thread_->DeRegisterModule( | 468 pacer_thread_->DeRegisterModule( |
471 receive_side_cc_.GetRemoteBitrateEstimator(true)); | 469 receive_side_cc_.GetRemoteBitrateEstimator(true)); |
472 module_process_thread_->DeRegisterModule(&receive_side_cc_); | 470 module_process_thread_->DeRegisterModule(&receive_side_cc_); |
473 module_process_thread_->DeRegisterModule(call_stats_.get()); | 471 module_process_thread_->DeRegisterModule(call_stats_.get()); |
474 module_process_thread_->Stop(); | 472 module_process_thread_->Stop(); |
475 call_stats_->DeregisterStatsObserver(&receive_side_cc_); | 473 call_stats_->DeregisterStatsObserver(&receive_side_cc_); |
476 call_stats_->DeregisterStatsObserver(transport_send_->send_side_cc()); | 474 call_stats_->DeregisterStatsObserver(transport_send_->send_side_cc()); |
477 | 475 |
478 int64_t first_sent_packet_ms = | 476 int64_t first_sent_packet_ms = |
479 transport_send_->send_side_cc()->GetFirstPacketTimeMs(); | 477 transport_send_->send_side_cc()->GetFirstPacketTimeMs(); |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 } | 1189 } |
1192 estimated_send_bitrate_kbps_counter_.Add(target_bitrate_bps / 1000); | 1190 estimated_send_bitrate_kbps_counter_.Add(target_bitrate_bps / 1000); |
1193 // Pacer bitrate may be higher than bitrate estimate if enforcing min bitrate. | 1191 // Pacer bitrate may be higher than bitrate estimate if enforcing min bitrate. |
1194 uint32_t pacer_bitrate_bps = | 1192 uint32_t pacer_bitrate_bps = |
1195 std::max(target_bitrate_bps, min_allocated_send_bitrate_bps_); | 1193 std::max(target_bitrate_bps, min_allocated_send_bitrate_bps_); |
1196 pacer_bitrate_kbps_counter_.Add(pacer_bitrate_bps / 1000); | 1194 pacer_bitrate_kbps_counter_.Add(pacer_bitrate_bps / 1000); |
1197 } | 1195 } |
1198 | 1196 |
1199 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, | 1197 void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps, |
1200 uint32_t max_padding_bitrate_bps) { | 1198 uint32_t max_padding_bitrate_bps) { |
1201 transport_send_->send_side_cc()->SetAllocatedSendBitrateLimits( | 1199 transport_send_->SetAllocatedSendBitrateLimits(min_send_bitrate_bps, |
1202 min_send_bitrate_bps, max_padding_bitrate_bps); | 1200 max_padding_bitrate_bps); |
1203 rtc::CritScope lock(&bitrate_crit_); | 1201 rtc::CritScope lock(&bitrate_crit_); |
1204 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; | 1202 min_allocated_send_bitrate_bps_ = min_send_bitrate_bps; |
1205 configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps; | 1203 configured_max_padding_bitrate_bps_ = max_padding_bitrate_bps; |
1206 } | 1204 } |
1207 | 1205 |
1208 void Call::ConfigureSync(const std::string& sync_group) { | 1206 void Call::ConfigureSync(const std::string& sync_group) { |
1209 // Set sync only if there was no previous one. | 1207 // Set sync only if there was no previous one. |
1210 if (sync_group.empty()) | 1208 if (sync_group.empty()) |
1211 return; | 1209 return; |
1212 | 1210 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1420 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1423 receive_side_cc_.OnReceivedPacket( | 1421 receive_side_cc_.OnReceivedPacket( |
1424 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1422 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1425 header); | 1423 header); |
1426 } | 1424 } |
1427 } | 1425 } |
1428 | 1426 |
1429 } // namespace internal | 1427 } // namespace internal |
1430 | 1428 |
1431 } // namespace webrtc | 1429 } // namespace webrtc |
OLD | NEW |