| 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 #include "webrtc/video/video_send_stream.h" | 10 #include "webrtc/video/video_send_stream.h" |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 #include <sstream> | 14 #include <sstream> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <utility> | 16 #include <utility> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/file.h" | 20 #include "webrtc/base/file.h" |
| 21 #include "webrtc/base/location.h" | 21 #include "webrtc/base/location.h" |
| 22 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
| 23 #include "webrtc/base/trace_event.h" | 23 #include "webrtc/base/trace_event.h" |
| 24 #include "webrtc/base/weak_ptr.h" | 24 #include "webrtc/base/weak_ptr.h" |
| 25 #include "webrtc/common_types.h" | 25 #include "webrtc/common_types.h" |
| 26 #include "webrtc/common_video/include/video_bitrate_allocator.h" | 26 #include "webrtc/common_video/include/video_bitrate_allocator.h" |
| 27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 28 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 28 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.h" |
| 29 #include "webrtc/modules/pacing/packet_router.h" | 29 #include "webrtc/modules/pacing/packet_router.h" |
| 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 31 #include "webrtc/modules/utility/include/process_thread.h" | 31 #include "webrtc/modules/utility/include/process_thread.h" |
| 32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
| 33 #include "webrtc/system_wrappers/include/field_trial.h" | 33 #include "webrtc/system_wrappers/include/field_trial.h" |
| 34 #include "webrtc/video/call_stats.h" | 34 #include "webrtc/video/call_stats.h" |
| 35 #include "webrtc/video/vie_remb.h" | 35 #include "webrtc/video/vie_remb.h" |
| 36 #include "webrtc/video_send_stream.h" | 36 #include "webrtc/video_send_stream.h" |
| 37 | 37 |
| 38 namespace webrtc { | 38 namespace webrtc { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // arbitrary thread. | 318 // arbitrary thread. |
| 319 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, | 319 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, |
| 320 public webrtc::OverheadObserver, | 320 public webrtc::OverheadObserver, |
| 321 public webrtc::VCMProtectionCallback, | 321 public webrtc::VCMProtectionCallback, |
| 322 public ViEEncoder::EncoderSink, | 322 public ViEEncoder::EncoderSink, |
| 323 public VideoBitrateAllocationObserver { | 323 public VideoBitrateAllocationObserver { |
| 324 public: | 324 public: |
| 325 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, | 325 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
| 326 rtc::TaskQueue* worker_queue, | 326 rtc::TaskQueue* worker_queue, |
| 327 CallStats* call_stats, | 327 CallStats* call_stats, |
| 328 CongestionController* congestion_controller, | 328 SendSideCongestionController* send_side_cc, |
| 329 PacketRouter* packet_router, | 329 PacketRouter* packet_router, |
| 330 BitrateAllocator* bitrate_allocator, | 330 BitrateAllocator* bitrate_allocator, |
| 331 SendDelayStats* send_delay_stats, | 331 SendDelayStats* send_delay_stats, |
| 332 VieRemb* remb, | 332 VieRemb* remb, |
| 333 ViEEncoder* vie_encoder, | 333 ViEEncoder* vie_encoder, |
| 334 RtcEventLog* event_log, | 334 RtcEventLog* event_log, |
| 335 const VideoSendStream::Config* config, | 335 const VideoSendStream::Config* config, |
| 336 int initial_encoder_max_bitrate, | 336 int initial_encoder_max_bitrate, |
| 337 std::map<uint32_t, RtpState> suspended_ssrcs); | 337 std::map<uint32_t, RtpState> suspended_ssrcs); |
| 338 ~VideoSendStreamImpl() override; | 338 ~VideoSendStreamImpl() override; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 404 |
| 405 ProcessThread* module_process_thread_; | 405 ProcessThread* module_process_thread_; |
| 406 rtc::ThreadChecker module_process_thread_checker_; | 406 rtc::ThreadChecker module_process_thread_checker_; |
| 407 rtc::TaskQueue* const worker_queue_; | 407 rtc::TaskQueue* const worker_queue_; |
| 408 | 408 |
| 409 rtc::CriticalSection encoder_activity_crit_sect_; | 409 rtc::CriticalSection encoder_activity_crit_sect_; |
| 410 CheckEncoderActivityTask* check_encoder_activity_task_ | 410 CheckEncoderActivityTask* check_encoder_activity_task_ |
| 411 GUARDED_BY(encoder_activity_crit_sect_); | 411 GUARDED_BY(encoder_activity_crit_sect_); |
| 412 | 412 |
| 413 CallStats* const call_stats_; | 413 CallStats* const call_stats_; |
| 414 CongestionController* const congestion_controller_; | 414 SendSideCongestionController* const send_side_cc_; |
| 415 PacketRouter* const packet_router_; | 415 PacketRouter* const packet_router_; |
| 416 BitrateAllocator* const bitrate_allocator_; | 416 BitrateAllocator* const bitrate_allocator_; |
| 417 VieRemb* const remb_; | 417 VieRemb* const remb_; |
| 418 | 418 |
| 419 // TODO(brandtr): Move ownership to PayloadRouter. | 419 // TODO(brandtr): Move ownership to PayloadRouter. |
| 420 std::unique_ptr<FlexfecSender> flexfec_sender_; | 420 std::unique_ptr<FlexfecSender> flexfec_sender_; |
| 421 | 421 |
| 422 rtc::CriticalSection ivf_writers_crit_; | 422 rtc::CriticalSection ivf_writers_crit_; |
| 423 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( | 423 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( |
| 424 ivf_writers_crit_); | 424 ivf_writers_crit_); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 453 // TODO(tommi): See if there's a more elegant way to create a task that creates | 453 // TODO(tommi): See if there's a more elegant way to create a task that creates |
| 454 // an object on the correct task queue. | 454 // an object on the correct task queue. |
| 455 class VideoSendStream::ConstructionTask : public rtc::QueuedTask { | 455 class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
| 456 public: | 456 public: |
| 457 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, | 457 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, |
| 458 rtc::Event* done_event, | 458 rtc::Event* done_event, |
| 459 SendStatisticsProxy* stats_proxy, | 459 SendStatisticsProxy* stats_proxy, |
| 460 ViEEncoder* vie_encoder, | 460 ViEEncoder* vie_encoder, |
| 461 ProcessThread* module_process_thread, | 461 ProcessThread* module_process_thread, |
| 462 CallStats* call_stats, | 462 CallStats* call_stats, |
| 463 CongestionController* congestion_controller, | 463 SendSideCongestionController* send_side_cc, |
| 464 PacketRouter* packet_router, | 464 PacketRouter* packet_router, |
| 465 BitrateAllocator* bitrate_allocator, | 465 BitrateAllocator* bitrate_allocator, |
| 466 SendDelayStats* send_delay_stats, | 466 SendDelayStats* send_delay_stats, |
| 467 VieRemb* remb, | 467 VieRemb* remb, |
| 468 RtcEventLog* event_log, | 468 RtcEventLog* event_log, |
| 469 const VideoSendStream::Config* config, | 469 const VideoSendStream::Config* config, |
| 470 int initial_encoder_max_bitrate, | 470 int initial_encoder_max_bitrate, |
| 471 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 471 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 472 : send_stream_(send_stream), | 472 : send_stream_(send_stream), |
| 473 done_event_(done_event), | 473 done_event_(done_event), |
| 474 stats_proxy_(stats_proxy), | 474 stats_proxy_(stats_proxy), |
| 475 vie_encoder_(vie_encoder), | 475 vie_encoder_(vie_encoder), |
| 476 call_stats_(call_stats), | 476 call_stats_(call_stats), |
| 477 congestion_controller_(congestion_controller), | 477 send_side_cc_(send_side_cc), |
| 478 packet_router_(packet_router), | 478 packet_router_(packet_router), |
| 479 bitrate_allocator_(bitrate_allocator), | 479 bitrate_allocator_(bitrate_allocator), |
| 480 send_delay_stats_(send_delay_stats), | 480 send_delay_stats_(send_delay_stats), |
| 481 remb_(remb), | 481 remb_(remb), |
| 482 event_log_(event_log), | 482 event_log_(event_log), |
| 483 config_(config), | 483 config_(config), |
| 484 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), | 484 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), |
| 485 suspended_ssrcs_(suspended_ssrcs) {} | 485 suspended_ssrcs_(suspended_ssrcs) {} |
| 486 | 486 |
| 487 ~ConstructionTask() override { done_event_->Set(); } | 487 ~ConstructionTask() override { done_event_->Set(); } |
| 488 | 488 |
| 489 private: | 489 private: |
| 490 bool Run() override { | 490 bool Run() override { |
| 491 send_stream_->reset(new VideoSendStreamImpl( | 491 send_stream_->reset(new VideoSendStreamImpl( |
| 492 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, | 492 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, send_side_cc_, |
| 493 congestion_controller_, packet_router_, bitrate_allocator_, | 493 packet_router_, bitrate_allocator_, send_delay_stats_, remb_, |
| 494 send_delay_stats_, remb_, vie_encoder_, event_log_, config_, | 494 vie_encoder_, event_log_, config_, initial_encoder_max_bitrate_, |
| 495 initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); | 495 std::move(suspended_ssrcs_))); |
| 496 return true; | 496 return true; |
| 497 } | 497 } |
| 498 | 498 |
| 499 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; | 499 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; |
| 500 rtc::Event* const done_event_; | 500 rtc::Event* const done_event_; |
| 501 SendStatisticsProxy* const stats_proxy_; | 501 SendStatisticsProxy* const stats_proxy_; |
| 502 ViEEncoder* const vie_encoder_; | 502 ViEEncoder* const vie_encoder_; |
| 503 CallStats* const call_stats_; | 503 CallStats* const call_stats_; |
| 504 CongestionController* const congestion_controller_; | 504 SendSideCongestionController* const send_side_cc_; |
| 505 PacketRouter* const packet_router_; | 505 PacketRouter* const packet_router_; |
| 506 BitrateAllocator* const bitrate_allocator_; | 506 BitrateAllocator* const bitrate_allocator_; |
| 507 SendDelayStats* const send_delay_stats_; | 507 SendDelayStats* const send_delay_stats_; |
| 508 VieRemb* const remb_; | 508 VieRemb* const remb_; |
| 509 RtcEventLog* const event_log_; | 509 RtcEventLog* const event_log_; |
| 510 const VideoSendStream::Config* config_; | 510 const VideoSendStream::Config* config_; |
| 511 int initial_encoder_max_bitrate_; | 511 int initial_encoder_max_bitrate_; |
| 512 std::map<uint32_t, RtpState> suspended_ssrcs_; | 512 std::map<uint32_t, RtpState> suspended_ssrcs_; |
| 513 }; | 513 }; |
| 514 | 514 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 rtc::WeakPtr<VideoSendStreamImpl> send_stream_; | 609 rtc::WeakPtr<VideoSendStreamImpl> send_stream_; |
| 610 std::vector<VideoStream> streams_; | 610 std::vector<VideoStream> streams_; |
| 611 int min_transmit_bitrate_bps_; | 611 int min_transmit_bitrate_bps_; |
| 612 }; | 612 }; |
| 613 | 613 |
| 614 VideoSendStream::VideoSendStream( | 614 VideoSendStream::VideoSendStream( |
| 615 int num_cpu_cores, | 615 int num_cpu_cores, |
| 616 ProcessThread* module_process_thread, | 616 ProcessThread* module_process_thread, |
| 617 rtc::TaskQueue* worker_queue, | 617 rtc::TaskQueue* worker_queue, |
| 618 CallStats* call_stats, | 618 CallStats* call_stats, |
| 619 CongestionController* congestion_controller, | 619 SendSideCongestionController* send_side_cc, |
| 620 PacketRouter* packet_router, | 620 PacketRouter* packet_router, |
| 621 BitrateAllocator* bitrate_allocator, | 621 BitrateAllocator* bitrate_allocator, |
| 622 SendDelayStats* send_delay_stats, | 622 SendDelayStats* send_delay_stats, |
| 623 VieRemb* remb, | 623 VieRemb* remb, |
| 624 RtcEventLog* event_log, | 624 RtcEventLog* event_log, |
| 625 VideoSendStream::Config config, | 625 VideoSendStream::Config config, |
| 626 VideoEncoderConfig encoder_config, | 626 VideoEncoderConfig encoder_config, |
| 627 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 627 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 628 : worker_queue_(worker_queue), | 628 : worker_queue_(worker_queue), |
| 629 thread_sync_event_(false /* manual_reset */, false), | 629 thread_sync_event_(false /* manual_reset */, false), |
| 630 stats_proxy_(Clock::GetRealTimeClock(), | 630 stats_proxy_(Clock::GetRealTimeClock(), |
| 631 config, | 631 config, |
| 632 encoder_config.content_type), | 632 encoder_config.content_type), |
| 633 config_(std::move(config)), | 633 config_(std::move(config)), |
| 634 content_type_(encoder_config.content_type) { | 634 content_type_(encoder_config.content_type) { |
| 635 vie_encoder_.reset(new ViEEncoder( | 635 vie_encoder_.reset(new ViEEncoder( |
| 636 num_cpu_cores, &stats_proxy_, config_.encoder_settings, | 636 num_cpu_cores, &stats_proxy_, config_.encoder_settings, |
| 637 config_.pre_encode_callback, config_.post_encode_callback)); | 637 config_.pre_encode_callback, config_.post_encode_callback)); |
| 638 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( | 638 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( |
| 639 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), | 639 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), |
| 640 module_process_thread, call_stats, congestion_controller, packet_router, | 640 module_process_thread, call_stats, send_side_cc, packet_router, |
| 641 bitrate_allocator, send_delay_stats, remb, event_log, &config_, | 641 bitrate_allocator, send_delay_stats, remb, event_log, &config_, |
| 642 encoder_config.max_bitrate_bps, suspended_ssrcs))); | 642 encoder_config.max_bitrate_bps, suspended_ssrcs))); |
| 643 | 643 |
| 644 // Wait for ConstructionTask to complete so that |send_stream_| can be used. | 644 // Wait for ConstructionTask to complete so that |send_stream_| can be used. |
| 645 // |module_process_thread| must be registered and deregistered on the thread | 645 // |module_process_thread| must be registered and deregistered on the thread |
| 646 // it was created on. | 646 // it was created on. |
| 647 thread_sync_event_.Wait(rtc::Event::kForever); | 647 thread_sync_event_.Wait(rtc::Event::kForever); |
| 648 send_stream_->RegisterProcessThread(module_process_thread); | 648 send_stream_->RegisterProcessThread(module_process_thread); |
| 649 // TODO(sprang): Enable this also for regular video calls if it works well. | 649 // TODO(sprang): Enable this also for regular video calls if it works well. |
| 650 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { | 650 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 void VideoSendStream::EnableEncodedFrameRecording( | 743 void VideoSendStream::EnableEncodedFrameRecording( |
| 744 const std::vector<rtc::PlatformFile>& files, | 744 const std::vector<rtc::PlatformFile>& files, |
| 745 size_t byte_limit) { | 745 size_t byte_limit) { |
| 746 send_stream_->EnableEncodedFrameRecording(files, byte_limit); | 746 send_stream_->EnableEncodedFrameRecording(files, byte_limit); |
| 747 } | 747 } |
| 748 | 748 |
| 749 VideoSendStreamImpl::VideoSendStreamImpl( | 749 VideoSendStreamImpl::VideoSendStreamImpl( |
| 750 SendStatisticsProxy* stats_proxy, | 750 SendStatisticsProxy* stats_proxy, |
| 751 rtc::TaskQueue* worker_queue, | 751 rtc::TaskQueue* worker_queue, |
| 752 CallStats* call_stats, | 752 CallStats* call_stats, |
| 753 CongestionController* congestion_controller, | 753 SendSideCongestionController* send_side_cc, |
| 754 PacketRouter* packet_router, | 754 PacketRouter* packet_router, |
| 755 BitrateAllocator* bitrate_allocator, | 755 BitrateAllocator* bitrate_allocator, |
| 756 SendDelayStats* send_delay_stats, | 756 SendDelayStats* send_delay_stats, |
| 757 VieRemb* remb, | 757 VieRemb* remb, |
| 758 ViEEncoder* vie_encoder, | 758 ViEEncoder* vie_encoder, |
| 759 RtcEventLog* event_log, | 759 RtcEventLog* event_log, |
| 760 const VideoSendStream::Config* config, | 760 const VideoSendStream::Config* config, |
| 761 int initial_encoder_max_bitrate, | 761 int initial_encoder_max_bitrate, |
| 762 std::map<uint32_t, RtpState> suspended_ssrcs) | 762 std::map<uint32_t, RtpState> suspended_ssrcs) |
| 763 : send_side_bwe_with_overhead_( | 763 : send_side_bwe_with_overhead_( |
| 764 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), | 764 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), |
| 765 stats_proxy_(stats_proxy), | 765 stats_proxy_(stats_proxy), |
| 766 config_(config), | 766 config_(config), |
| 767 suspended_ssrcs_(std::move(suspended_ssrcs)), | 767 suspended_ssrcs_(std::move(suspended_ssrcs)), |
| 768 module_process_thread_(nullptr), | 768 module_process_thread_(nullptr), |
| 769 worker_queue_(worker_queue), | 769 worker_queue_(worker_queue), |
| 770 check_encoder_activity_task_(nullptr), | 770 check_encoder_activity_task_(nullptr), |
| 771 call_stats_(call_stats), | 771 call_stats_(call_stats), |
| 772 congestion_controller_(congestion_controller), | 772 send_side_cc_(send_side_cc), |
| 773 packet_router_(packet_router), | 773 packet_router_(packet_router), |
| 774 bitrate_allocator_(bitrate_allocator), | 774 bitrate_allocator_(bitrate_allocator), |
| 775 remb_(remb), | 775 remb_(remb), |
| 776 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), | 776 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), |
| 777 max_padding_bitrate_(0), | 777 max_padding_bitrate_(0), |
| 778 encoder_min_bitrate_bps_(0), | 778 encoder_min_bitrate_bps_(0), |
| 779 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), | 779 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), |
| 780 encoder_target_rate_bps_(0), | 780 encoder_target_rate_bps_(0), |
| 781 vie_encoder_(vie_encoder), | 781 vie_encoder_(vie_encoder), |
| 782 encoder_feedback_(Clock::GetRealTimeClock(), | 782 encoder_feedback_(Clock::GetRealTimeClock(), |
| 783 config_->rtp.ssrcs, | 783 config_->rtp.ssrcs, |
| 784 vie_encoder), | 784 vie_encoder), |
| 785 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), | 785 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), |
| 786 bandwidth_observer_(congestion_controller_->GetBitrateController() | 786 bandwidth_observer_( |
| 787 ->CreateRtcpBandwidthObserver()), | 787 send_side_cc_->GetBitrateController()->CreateRtcpBandwidthObserver()), |
| 788 rtp_rtcp_modules_(CreateRtpRtcpModules( | 788 rtp_rtcp_modules_( |
| 789 config_->send_transport, | 789 CreateRtpRtcpModules(config_->send_transport, |
| 790 &encoder_feedback_, | 790 &encoder_feedback_, |
| 791 bandwidth_observer_.get(), | 791 bandwidth_observer_.get(), |
| 792 congestion_controller_, | 792 send_side_cc_, |
| 793 call_stats_->rtcp_rtt_stats(), | 793 call_stats_->rtcp_rtt_stats(), |
| 794 congestion_controller_->pacer(), | 794 send_side_cc_->pacer(), |
| 795 packet_router_, | 795 packet_router_, |
| 796 flexfec_sender_.get(), | 796 flexfec_sender_.get(), |
| 797 stats_proxy_, | 797 stats_proxy_, |
| 798 send_delay_stats, | 798 send_delay_stats, |
| 799 event_log, | 799 event_log, |
| 800 congestion_controller_->GetRetransmissionRateLimiter(), | 800 send_side_cc_->GetRetransmissionRateLimiter(), |
| 801 this, | 801 this, |
| 802 config_->rtp.ssrcs.size())), | 802 config_->rtp.ssrcs.size())), |
| 803 payload_router_(rtp_rtcp_modules_, | 803 payload_router_(rtp_rtcp_modules_, |
| 804 config_->encoder_settings.payload_type), | 804 config_->encoder_settings.payload_type), |
| 805 weak_ptr_factory_(this), | 805 weak_ptr_factory_(this), |
| 806 overhead_bytes_per_packet_(0), | 806 overhead_bytes_per_packet_(0), |
| 807 transport_overhead_bytes_per_packet_(0) { | 807 transport_overhead_bytes_per_packet_(0) { |
| 808 RTC_DCHECK_RUN_ON(worker_queue_); | 808 RTC_DCHECK_RUN_ON(worker_queue_); |
| 809 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); | 809 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); |
| 810 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 810 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
| 811 module_process_thread_checker_.DetachFromThread(); | 811 module_process_thread_checker_.DetachFromThread(); |
| 812 | 812 |
| 813 RTC_DCHECK(!config_->rtp.ssrcs.empty()); | 813 RTC_DCHECK(!config_->rtp.ssrcs.empty()); |
| 814 RTC_DCHECK(call_stats_); | 814 RTC_DCHECK(call_stats_); |
| 815 RTC_DCHECK(congestion_controller_); | 815 RTC_DCHECK(send_side_cc_); |
| 816 RTC_DCHECK(remb_); | 816 RTC_DCHECK(remb_); |
| 817 | 817 |
| 818 congestion_controller_->EnablePeriodicAlrProbing( | 818 send_side_cc_->EnablePeriodicAlrProbing( |
| 819 config_->periodic_alr_bandwidth_probing); | 819 config_->periodic_alr_bandwidth_probing); |
| 820 | 820 |
| 821 // RTP/RTCP initialization. | 821 // RTP/RTCP initialization. |
| 822 | 822 |
| 823 // We add the highest spatial layer first to ensure it'll be prioritized | 823 // We add the highest spatial layer first to ensure it'll be prioritized |
| 824 // when sending padding, with the hope that the packet rate will be smaller, | 824 // when sending padding, with the hope that the packet rate will be smaller, |
| 825 // and that it's more important to protect than the lower layers. | 825 // and that it's more important to protect than the lower layers. |
| 826 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 826 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 827 packet_router_->AddRtpModule(rtp_rtcp); | 827 packet_router_->AddRtpModule(rtp_rtcp); |
| 828 | 828 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 | 1327 |
| 1328 void VideoSendStreamImpl::SetTransportOverhead( | 1328 void VideoSendStreamImpl::SetTransportOverhead( |
| 1329 size_t transport_overhead_bytes_per_packet) { | 1329 size_t transport_overhead_bytes_per_packet) { |
| 1330 if (transport_overhead_bytes_per_packet >= static_cast<int>(kPathMTU)) { | 1330 if (transport_overhead_bytes_per_packet >= static_cast<int>(kPathMTU)) { |
| 1331 LOG(LS_ERROR) << "Transport overhead exceeds size of ethernet frame"; | 1331 LOG(LS_ERROR) << "Transport overhead exceeds size of ethernet frame"; |
| 1332 return; | 1332 return; |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 transport_overhead_bytes_per_packet_ = transport_overhead_bytes_per_packet; | 1335 transport_overhead_bytes_per_packet_ = transport_overhead_bytes_per_packet; |
| 1336 | 1336 |
| 1337 congestion_controller_->SetTransportOverhead( | 1337 send_side_cc_->SetTransportOverhead(transport_overhead_bytes_per_packet_); |
| 1338 transport_overhead_bytes_per_packet_); | |
| 1339 | 1338 |
| 1340 size_t rtp_packet_size = | 1339 size_t rtp_packet_size = |
| 1341 std::min(config_->rtp.max_packet_size, | 1340 std::min(config_->rtp.max_packet_size, |
| 1342 kPathMTU - transport_overhead_bytes_per_packet_); | 1341 kPathMTU - transport_overhead_bytes_per_packet_); |
| 1343 | 1342 |
| 1344 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1343 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 1345 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1344 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
| 1346 } | 1345 } |
| 1347 } | 1346 } |
| 1348 | 1347 |
| 1349 } // namespace internal | 1348 } // namespace internal |
| 1350 } // namespace webrtc | 1349 } // namespace webrtc |
| OLD | NEW |