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

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

Issue 2789843002: Delete VieRemb class, move functionality to PacketRouter. (Closed)
Patch Set: Delete obsolete suppression for PacketRouterTest.SendTransportFeedback. Created 3 years, 8 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "webrtc/system_wrappers/include/clock.h" 49 #include "webrtc/system_wrappers/include/clock.h"
50 #include "webrtc/system_wrappers/include/cpu_info.h" 50 #include "webrtc/system_wrappers/include/cpu_info.h"
51 #include "webrtc/system_wrappers/include/metrics.h" 51 #include "webrtc/system_wrappers/include/metrics.h"
52 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" 52 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
53 #include "webrtc/system_wrappers/include/trace.h" 53 #include "webrtc/system_wrappers/include/trace.h"
54 #include "webrtc/video/call_stats.h" 54 #include "webrtc/video/call_stats.h"
55 #include "webrtc/video/send_delay_stats.h" 55 #include "webrtc/video/send_delay_stats.h"
56 #include "webrtc/video/stats_counter.h" 56 #include "webrtc/video/stats_counter.h"
57 #include "webrtc/video/video_receive_stream.h" 57 #include "webrtc/video/video_receive_stream.h"
58 #include "webrtc/video/video_send_stream.h" 58 #include "webrtc/video/video_send_stream.h"
59 #include "webrtc/video/vie_remb.h"
60 59
61 namespace webrtc { 60 namespace webrtc {
62 61
63 const int Call::Config::kDefaultStartBitrateBps = 300000; 62 const int Call::Config::kDefaultStartBitrateBps = 300000;
64 63
65 namespace { 64 namespace {
66 65
67 // TODO(nisse): This really begs for a shared context struct. 66 // TODO(nisse): This really begs for a shared context struct.
68 bool UseSendSideBwe(const std::vector<RtpExtension>& extensions, 67 bool UseSendSideBwe(const std::vector<RtpExtension>& extensions,
69 bool transport_cc) { 68 bool transport_cc) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // OnNetworkChanged from multiple threads. 300 // OnNetworkChanged from multiple threads.
302 rtc::CriticalSection bitrate_crit_; 301 rtc::CriticalSection bitrate_crit_;
303 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 302 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
304 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 303 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
305 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 304 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
306 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 305 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
307 306
308 std::map<std::string, rtc::NetworkRoute> network_routes_; 307 std::map<std::string, rtc::NetworkRoute> network_routes_;
309 308
310 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_; 309 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_;
311 VieRemb remb_;
312 ReceiveSideCongestionController receive_side_cc_; 310 ReceiveSideCongestionController receive_side_cc_;
313 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; 311 const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
314 const int64_t start_ms_; 312 const int64_t start_ms_;
315 // TODO(perkj): |worker_queue_| is supposed to replace 313 // TODO(perkj): |worker_queue_| is supposed to replace
316 // |module_process_thread_|. 314 // |module_process_thread_|.
317 // |worker_queue| is defined last to ensure all pending tasks are cancelled 315 // |worker_queue| is defined last to ensure all pending tasks are cancelled
318 // and deleted before any other members. 316 // and deleted before any other members.
319 rtc::TaskQueue worker_queue_; 317 rtc::TaskQueue worker_queue_;
320 318
321 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 319 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 event_log_(config.event_log), 357 event_log_(config.event_log),
360 first_packet_sent_ms_(-1), 358 first_packet_sent_ms_(-1),
361 received_bytes_per_second_counter_(clock_, nullptr, true), 359 received_bytes_per_second_counter_(clock_, nullptr, true),
362 received_audio_bytes_per_second_counter_(clock_, nullptr, true), 360 received_audio_bytes_per_second_counter_(clock_, nullptr, true),
363 received_video_bytes_per_second_counter_(clock_, nullptr, true), 361 received_video_bytes_per_second_counter_(clock_, nullptr, true),
364 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), 362 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true),
365 min_allocated_send_bitrate_bps_(0), 363 min_allocated_send_bitrate_bps_(0),
366 configured_max_padding_bitrate_bps_(0), 364 configured_max_padding_bitrate_bps_(0),
367 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true), 365 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true),
368 pacer_bitrate_kbps_counter_(clock_, nullptr, true), 366 pacer_bitrate_kbps_counter_(clock_, nullptr, true),
369 remb_(clock_), 367 receive_side_cc_(clock_, transport_send->packet_router()),
370 receive_side_cc_(clock_, &remb_, transport_send->packet_router()),
371 video_send_delay_stats_(new SendDelayStats(clock_)), 368 video_send_delay_stats_(new SendDelayStats(clock_)),
372 start_ms_(clock_->TimeInMilliseconds()), 369 start_ms_(clock_->TimeInMilliseconds()),
373 worker_queue_("call_worker_queue") { 370 worker_queue_("call_worker_queue") {
374 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 371 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
375 RTC_DCHECK(config.event_log != nullptr); 372 RTC_DCHECK(config.event_log != nullptr);
376 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 373 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
377 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 374 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
378 config.bitrate_config.min_bitrate_bps); 375 config.bitrate_config.min_bitrate_bps);
379 if (config.bitrate_config.max_bitrate_bps != -1) { 376 if (config.bitrate_config.max_bitrate_bps != -1) {
380 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 377 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
(...skipping 17 matching lines...) Expand all
398 RTC_FROM_HERE); 395 RTC_FROM_HERE);
399 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), 396 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(),
400 RTC_FROM_HERE); 397 RTC_FROM_HERE);
401 pacer_thread_->RegisterModule( 398 pacer_thread_->RegisterModule(
402 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); 399 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE);
403 400
404 pacer_thread_->Start(); 401 pacer_thread_->Start();
405 } 402 }
406 403
407 Call::~Call() { 404 Call::~Call() {
408 RTC_DCHECK(!remb_.InUse());
409 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 405 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
410 406
411 RTC_CHECK(audio_send_ssrcs_.empty()); 407 RTC_CHECK(audio_send_ssrcs_.empty());
412 RTC_CHECK(video_send_ssrcs_.empty()); 408 RTC_CHECK(video_send_ssrcs_.empty());
413 RTC_CHECK(video_send_streams_.empty()); 409 RTC_CHECK(video_send_streams_.empty());
414 RTC_CHECK(audio_receive_ssrcs_.empty()); 410 RTC_CHECK(audio_receive_ssrcs_.empty());
415 RTC_CHECK(video_receive_ssrcs_.empty()); 411 RTC_CHECK(video_receive_ssrcs_.empty());
416 RTC_CHECK(video_receive_streams_.empty()); 412 RTC_CHECK(video_receive_streams_.empty());
417 413
418 pacer_thread_->Stop(); 414 pacer_thread_->Stop();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 video_send_delay_stats_->AddSsrcs(config); 653 video_send_delay_stats_->AddSsrcs(config);
658 event_log_->LogVideoSendStreamConfig(config); 654 event_log_->LogVideoSendStreamConfig(config);
659 655
660 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if 656 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
661 // the call has already started. 657 // the call has already started.
662 // Copy ssrcs from |config| since |config| is moved. 658 // Copy ssrcs from |config| since |config| is moved.
663 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; 659 std::vector<uint32_t> ssrcs = config.rtp.ssrcs;
664 VideoSendStream* send_stream = new VideoSendStream( 660 VideoSendStream* send_stream = new VideoSendStream(
665 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, 661 num_cpu_cores_, module_process_thread_.get(), &worker_queue_,
666 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(), 662 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(),
667 video_send_delay_stats_.get(), &remb_, event_log_, std::move(config), 663 video_send_delay_stats_.get(), event_log_, std::move(config),
668 std::move(encoder_config), suspended_video_send_ssrcs_); 664 std::move(encoder_config), suspended_video_send_ssrcs_);
669 665
670 { 666 {
671 WriteLockScoped write_lock(*send_crit_); 667 WriteLockScoped write_lock(*send_crit_);
672 for (uint32_t ssrc : ssrcs) { 668 for (uint32_t ssrc : ssrcs) {
673 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); 669 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end());
674 video_send_ssrcs_[ssrc] = send_stream; 670 video_send_ssrcs_[ssrc] = send_stream;
675 } 671 }
676 video_send_streams_.insert(send_stream); 672 video_send_streams_.insert(send_stream);
677 } 673 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 710
715 UpdateAggregateNetworkState(); 711 UpdateAggregateNetworkState();
716 delete send_stream_impl; 712 delete send_stream_impl;
717 } 713 }
718 714
719 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( 715 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
720 webrtc::VideoReceiveStream::Config configuration) { 716 webrtc::VideoReceiveStream::Config configuration) {
721 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); 717 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
722 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 718 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
723 719
724 VideoReceiveStream* receive_stream = new VideoReceiveStream( 720 VideoReceiveStream* receive_stream =
725 num_cpu_cores_, transport_send_->packet_router(), 721 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(),
726 std::move(configuration), module_process_thread_.get(), call_stats_.get(), 722 std::move(configuration),
727 &remb_); 723 module_process_thread_.get(), call_stats_.get());
728 724
729 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); 725 const webrtc::VideoReceiveStream::Config& config = receive_stream->config();
730 ReceiveRtpConfig receive_config(config.rtp.extensions, 726 ReceiveRtpConfig receive_config(config.rtp.extensions,
731 UseSendSideBwe(config)); 727 UseSendSideBwe(config));
732 { 728 {
733 WriteLockScoped write_lock(*receive_crit_); 729 WriteLockScoped write_lock(*receive_crit_);
734 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == 730 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
735 video_receive_ssrcs_.end()); 731 video_receive_ssrcs_.end());
736 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 732 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
737 if (config.rtp.rtx_ssrc) { 733 if (config.rtp.rtx_ssrc) {
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1318 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1323 receive_side_cc_.OnReceivedPacket( 1319 receive_side_cc_.OnReceivedPacket(
1324 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1320 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1325 header); 1321 header);
1326 } 1322 }
1327 } 1323 }
1328 1324
1329 } // namespace internal 1325 } // namespace internal
1330 1326
1331 } // namespace webrtc 1327 } // namespace webrtc
OLDNEW
« no previous file with comments | « tools-webrtc/valgrind/memcheck/suppressions.txt ('k') | webrtc/call/rtp_transport_controller_send.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698