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

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

Issue 2789843002: Delete VieRemb class, move functionality to PacketRouter. (Closed)
Patch Set: Rewrote OnReceivedPacketWithAbsSendTime test. 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // OnNetworkChanged from multiple threads. 303 // OnNetworkChanged from multiple threads.
305 rtc::CriticalSection bitrate_crit_; 304 rtc::CriticalSection bitrate_crit_;
306 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 305 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
307 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 306 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
308 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 307 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
309 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); 308 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_);
310 309
311 std::map<std::string, rtc::NetworkRoute> network_routes_; 310 std::map<std::string, rtc::NetworkRoute> network_routes_;
312 311
313 std::unique_ptr<RtpTransportControllerSend> transport_send_; 312 std::unique_ptr<RtpTransportControllerSend> transport_send_;
314 VieRemb remb_;
315 ReceiveSideCongestionController receive_side_cc_; 313 ReceiveSideCongestionController receive_side_cc_;
316 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; 314 const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
317 const int64_t start_ms_; 315 const int64_t start_ms_;
318 // TODO(perkj): |worker_queue_| is supposed to replace 316 // TODO(perkj): |worker_queue_| is supposed to replace
319 // |module_process_thread_|. 317 // |module_process_thread_|.
320 // |worker_queue| is defined last to ensure all pending tasks are cancelled 318 // |worker_queue| is defined last to ensure all pending tasks are cancelled
321 // and deleted before any other members. 319 // and deleted before any other members.
322 rtc::TaskQueue worker_queue_; 320 rtc::TaskQueue worker_queue_;
323 321
324 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 322 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 first_packet_sent_ms_(-1), 361 first_packet_sent_ms_(-1),
364 received_bytes_per_second_counter_(clock_, nullptr, true), 362 received_bytes_per_second_counter_(clock_, nullptr, true),
365 received_audio_bytes_per_second_counter_(clock_, nullptr, true), 363 received_audio_bytes_per_second_counter_(clock_, nullptr, true),
366 received_video_bytes_per_second_counter_(clock_, nullptr, true), 364 received_video_bytes_per_second_counter_(clock_, nullptr, true),
367 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true), 365 received_rtcp_bytes_per_second_counter_(clock_, nullptr, true),
368 min_allocated_send_bitrate_bps_(0), 366 min_allocated_send_bitrate_bps_(0),
369 configured_max_padding_bitrate_bps_(0), 367 configured_max_padding_bitrate_bps_(0),
370 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true), 368 estimated_send_bitrate_kbps_counter_(clock_, nullptr, true),
371 pacer_bitrate_kbps_counter_(clock_, nullptr, true), 369 pacer_bitrate_kbps_counter_(clock_, nullptr, true),
372 transport_send_(std::move(transport_send)), 370 transport_send_(std::move(transport_send)),
373 remb_(clock_), 371 receive_side_cc_(clock_, transport_send_->packet_router()),
374 receive_side_cc_(clock_, &remb_, transport_send_->packet_router()),
375 video_send_delay_stats_(new SendDelayStats(clock_)), 372 video_send_delay_stats_(new SendDelayStats(clock_)),
376 start_ms_(clock_->TimeInMilliseconds()), 373 start_ms_(clock_->TimeInMilliseconds()),
377 worker_queue_("call_worker_queue") { 374 worker_queue_("call_worker_queue") {
378 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 375 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
379 RTC_DCHECK(config.event_log != nullptr); 376 RTC_DCHECK(config.event_log != nullptr);
380 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 377 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
381 RTC_DCHECK_GT(config.bitrate_config.start_bitrate_bps, 378 RTC_DCHECK_GT(config.bitrate_config.start_bitrate_bps,
382 config.bitrate_config.min_bitrate_bps); 379 config.bitrate_config.min_bitrate_bps);
383 if (config.bitrate_config.max_bitrate_bps != -1) { 380 if (config.bitrate_config.max_bitrate_bps != -1) {
384 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 381 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
(...skipping 16 matching lines...) Expand all
401 RTC_FROM_HERE); 398 RTC_FROM_HERE);
402 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(), 399 pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(),
403 RTC_FROM_HERE); 400 RTC_FROM_HERE);
404 pacer_thread_->RegisterModule( 401 pacer_thread_->RegisterModule(
405 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE); 402 receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE);
406 403
407 pacer_thread_->Start(); 404 pacer_thread_->Start();
408 } 405 }
409 406
410 Call::~Call() { 407 Call::~Call() {
411 RTC_DCHECK(!remb_.InUse());
412 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 408 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
413 409
414 RTC_CHECK(audio_send_ssrcs_.empty()); 410 RTC_CHECK(audio_send_ssrcs_.empty());
415 RTC_CHECK(video_send_ssrcs_.empty()); 411 RTC_CHECK(video_send_ssrcs_.empty());
416 RTC_CHECK(video_send_streams_.empty()); 412 RTC_CHECK(video_send_streams_.empty());
417 RTC_CHECK(audio_receive_ssrcs_.empty()); 413 RTC_CHECK(audio_receive_ssrcs_.empty());
418 RTC_CHECK(video_receive_ssrcs_.empty()); 414 RTC_CHECK(video_receive_ssrcs_.empty());
419 RTC_CHECK(video_receive_streams_.empty()); 415 RTC_CHECK(video_receive_streams_.empty());
420 416
421 pacer_thread_->Stop(); 417 pacer_thread_->Stop();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 video_send_delay_stats_->AddSsrcs(config); 656 video_send_delay_stats_->AddSsrcs(config);
661 event_log_->LogVideoSendStreamConfig(config); 657 event_log_->LogVideoSendStreamConfig(config);
662 658
663 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if 659 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
664 // the call has already started. 660 // the call has already started.
665 // Copy ssrcs from |config| since |config| is moved. 661 // Copy ssrcs from |config| since |config| is moved.
666 std::vector<uint32_t> ssrcs = config.rtp.ssrcs; 662 std::vector<uint32_t> ssrcs = config.rtp.ssrcs;
667 VideoSendStream* send_stream = new VideoSendStream( 663 VideoSendStream* send_stream = new VideoSendStream(
668 num_cpu_cores_, module_process_thread_.get(), &worker_queue_, 664 num_cpu_cores_, module_process_thread_.get(), &worker_queue_,
669 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(), 665 call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(),
670 video_send_delay_stats_.get(), &remb_, event_log_, std::move(config), 666 video_send_delay_stats_.get(), event_log_, std::move(config),
671 std::move(encoder_config), suspended_video_send_ssrcs_); 667 std::move(encoder_config), suspended_video_send_ssrcs_);
672 668
673 { 669 {
674 WriteLockScoped write_lock(*send_crit_); 670 WriteLockScoped write_lock(*send_crit_);
675 for (uint32_t ssrc : ssrcs) { 671 for (uint32_t ssrc : ssrcs) {
676 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); 672 RTC_DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end());
677 video_send_ssrcs_[ssrc] = send_stream; 673 video_send_ssrcs_[ssrc] = send_stream;
678 } 674 }
679 video_send_streams_.insert(send_stream); 675 video_send_streams_.insert(send_stream);
680 } 676 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 713
718 UpdateAggregateNetworkState(); 714 UpdateAggregateNetworkState();
719 delete send_stream_impl; 715 delete send_stream_impl;
720 } 716 }
721 717
722 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( 718 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
723 webrtc::VideoReceiveStream::Config configuration) { 719 webrtc::VideoReceiveStream::Config configuration) {
724 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); 720 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
725 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 721 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
726 722
727 VideoReceiveStream* receive_stream = new VideoReceiveStream( 723 VideoReceiveStream* receive_stream =
728 num_cpu_cores_, transport_send_->packet_router(), 724 new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(),
729 std::move(configuration), module_process_thread_.get(), call_stats_.get(), 725 std::move(configuration),
730 &remb_); 726 module_process_thread_.get(), call_stats_.get());
731 727
732 const webrtc::VideoReceiveStream::Config& config = receive_stream->config(); 728 const webrtc::VideoReceiveStream::Config& config = receive_stream->config();
733 ReceiveRtpConfig receive_config(config.rtp.extensions, 729 ReceiveRtpConfig receive_config(config.rtp.extensions,
734 UseSendSideBwe(config)); 730 UseSendSideBwe(config));
735 { 731 {
736 WriteLockScoped write_lock(*receive_crit_); 732 WriteLockScoped write_lock(*receive_crit_);
737 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == 733 RTC_DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
738 video_receive_ssrcs_.end()); 734 video_receive_ssrcs_.end());
739 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 735 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
740 if (config.rtp.rtx_ssrc) { 736 if (config.rtp.rtx_ssrc) {
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1321 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1326 receive_side_cc_.OnReceivedPacket( 1322 receive_side_cc_.OnReceivedPacket(
1327 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1323 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1328 header); 1324 header);
1329 } 1325 }
1330 } 1326 }
1331 1327
1332 } // namespace internal 1328 } // namespace internal
1333 1329
1334 } // namespace webrtc 1330 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698