| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "webrtc/common_video/include/video_bitrate_allocator.h" | 27 #include "webrtc/common_video/include/video_bitrate_allocator.h" |
| 28 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 28 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 29 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.h" | 29 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.h" |
| 30 #include "webrtc/modules/pacing/packet_router.h" | 30 #include "webrtc/modules/pacing/packet_router.h" |
| 31 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 31 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 32 #include "webrtc/modules/utility/include/process_thread.h" | 32 #include "webrtc/modules/utility/include/process_thread.h" |
| 33 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 33 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
| 34 #include "webrtc/system_wrappers/include/field_trial.h" | 34 #include "webrtc/system_wrappers/include/field_trial.h" |
| 35 #include "webrtc/video/call_stats.h" | 35 #include "webrtc/video/call_stats.h" |
| 36 #include "webrtc/video/payload_router.h" | 36 #include "webrtc/video/payload_router.h" |
| 37 #include "webrtc/video/vie_remb.h" | |
| 38 #include "webrtc/video_send_stream.h" | 37 #include "webrtc/video_send_stream.h" |
| 39 | 38 |
| 40 namespace webrtc { | 39 namespace webrtc { |
| 41 | 40 |
| 42 static const int kMinSendSidePacketHistorySize = 600; | 41 static const int kMinSendSidePacketHistorySize = 600; |
| 43 namespace { | 42 namespace { |
| 44 | 43 |
| 45 // We don't do MTU discovery, so assume that we have the standard ethernet MTU. | 44 // We don't do MTU discovery, so assume that we have the standard ethernet MTU. |
| 46 const size_t kPathMTU = 1500; | 45 const size_t kPathMTU = 1500; |
| 47 | 46 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 public webrtc::VCMProtectionCallback, | 326 public webrtc::VCMProtectionCallback, |
| 328 public ViEEncoder::EncoderSink, | 327 public ViEEncoder::EncoderSink, |
| 329 public VideoBitrateAllocationObserver { | 328 public VideoBitrateAllocationObserver { |
| 330 public: | 329 public: |
| 331 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, | 330 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
| 332 rtc::TaskQueue* worker_queue, | 331 rtc::TaskQueue* worker_queue, |
| 333 CallStats* call_stats, | 332 CallStats* call_stats, |
| 334 RtpTransportControllerSendInterface* transport, | 333 RtpTransportControllerSendInterface* transport, |
| 335 BitrateAllocator* bitrate_allocator, | 334 BitrateAllocator* bitrate_allocator, |
| 336 SendDelayStats* send_delay_stats, | 335 SendDelayStats* send_delay_stats, |
| 337 VieRemb* remb, | |
| 338 ViEEncoder* vie_encoder, | 336 ViEEncoder* vie_encoder, |
| 339 RtcEventLog* event_log, | 337 RtcEventLog* event_log, |
| 340 const VideoSendStream::Config* config, | 338 const VideoSendStream::Config* config, |
| 341 int initial_encoder_max_bitrate, | 339 int initial_encoder_max_bitrate, |
| 342 std::map<uint32_t, RtpState> suspended_ssrcs); | 340 std::map<uint32_t, RtpState> suspended_ssrcs); |
| 343 ~VideoSendStreamImpl() override; | 341 ~VideoSendStreamImpl() override; |
| 344 | 342 |
| 345 // RegisterProcessThread register |module_process_thread| with those objects | 343 // RegisterProcessThread register |module_process_thread| with those objects |
| 346 // that use it. Registration has to happen on the thread were | 344 // that use it. Registration has to happen on the thread were |
| 347 // |module_process_thread| was created (libjingle's worker thread). | 345 // |module_process_thread| was created (libjingle's worker thread). |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 rtc::ThreadChecker module_process_thread_checker_; | 409 rtc::ThreadChecker module_process_thread_checker_; |
| 412 rtc::TaskQueue* const worker_queue_; | 410 rtc::TaskQueue* const worker_queue_; |
| 413 | 411 |
| 414 rtc::CriticalSection encoder_activity_crit_sect_; | 412 rtc::CriticalSection encoder_activity_crit_sect_; |
| 415 CheckEncoderActivityTask* check_encoder_activity_task_ | 413 CheckEncoderActivityTask* check_encoder_activity_task_ |
| 416 GUARDED_BY(encoder_activity_crit_sect_); | 414 GUARDED_BY(encoder_activity_crit_sect_); |
| 417 | 415 |
| 418 CallStats* const call_stats_; | 416 CallStats* const call_stats_; |
| 419 RtpTransportControllerSendInterface* const transport_; | 417 RtpTransportControllerSendInterface* const transport_; |
| 420 BitrateAllocator* const bitrate_allocator_; | 418 BitrateAllocator* const bitrate_allocator_; |
| 421 VieRemb* const remb_; | |
| 422 | 419 |
| 423 // TODO(brandtr): Move ownership to PayloadRouter. | 420 // TODO(brandtr): Move ownership to PayloadRouter. |
| 424 std::unique_ptr<FlexfecSender> flexfec_sender_; | 421 std::unique_ptr<FlexfecSender> flexfec_sender_; |
| 425 | 422 |
| 426 rtc::CriticalSection ivf_writers_crit_; | 423 rtc::CriticalSection ivf_writers_crit_; |
| 427 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( | 424 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( |
| 428 ivf_writers_crit_); | 425 ivf_writers_crit_); |
| 429 | 426 |
| 430 int max_padding_bitrate_; | 427 int max_padding_bitrate_; |
| 431 int encoder_min_bitrate_bps_; | 428 int encoder_min_bitrate_bps_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 460 public: | 457 public: |
| 461 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, | 458 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, |
| 462 rtc::Event* done_event, | 459 rtc::Event* done_event, |
| 463 SendStatisticsProxy* stats_proxy, | 460 SendStatisticsProxy* stats_proxy, |
| 464 ViEEncoder* vie_encoder, | 461 ViEEncoder* vie_encoder, |
| 465 ProcessThread* module_process_thread, | 462 ProcessThread* module_process_thread, |
| 466 CallStats* call_stats, | 463 CallStats* call_stats, |
| 467 RtpTransportControllerSendInterface* transport, | 464 RtpTransportControllerSendInterface* transport, |
| 468 BitrateAllocator* bitrate_allocator, | 465 BitrateAllocator* bitrate_allocator, |
| 469 SendDelayStats* send_delay_stats, | 466 SendDelayStats* send_delay_stats, |
| 470 VieRemb* remb, | |
| 471 RtcEventLog* event_log, | 467 RtcEventLog* event_log, |
| 472 const VideoSendStream::Config* config, | 468 const VideoSendStream::Config* config, |
| 473 int initial_encoder_max_bitrate, | 469 int initial_encoder_max_bitrate, |
| 474 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 470 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 475 : send_stream_(send_stream), | 471 : send_stream_(send_stream), |
| 476 done_event_(done_event), | 472 done_event_(done_event), |
| 477 stats_proxy_(stats_proxy), | 473 stats_proxy_(stats_proxy), |
| 478 vie_encoder_(vie_encoder), | 474 vie_encoder_(vie_encoder), |
| 479 call_stats_(call_stats), | 475 call_stats_(call_stats), |
| 480 transport_(transport), | 476 transport_(transport), |
| 481 bitrate_allocator_(bitrate_allocator), | 477 bitrate_allocator_(bitrate_allocator), |
| 482 send_delay_stats_(send_delay_stats), | 478 send_delay_stats_(send_delay_stats), |
| 483 remb_(remb), | |
| 484 event_log_(event_log), | 479 event_log_(event_log), |
| 485 config_(config), | 480 config_(config), |
| 486 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), | 481 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), |
| 487 suspended_ssrcs_(suspended_ssrcs) {} | 482 suspended_ssrcs_(suspended_ssrcs) {} |
| 488 | 483 |
| 489 ~ConstructionTask() override { done_event_->Set(); } | 484 ~ConstructionTask() override { done_event_->Set(); } |
| 490 | 485 |
| 491 private: | 486 private: |
| 492 bool Run() override { | 487 bool Run() override { |
| 493 send_stream_->reset(new VideoSendStreamImpl( | 488 send_stream_->reset(new VideoSendStreamImpl( |
| 494 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, | 489 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, |
| 495 bitrate_allocator_, send_delay_stats_, remb_, vie_encoder_, event_log_, | 490 bitrate_allocator_, send_delay_stats_, vie_encoder_, event_log_, |
| 496 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); | 491 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); |
| 497 return true; | 492 return true; |
| 498 } | 493 } |
| 499 | 494 |
| 500 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; | 495 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; |
| 501 rtc::Event* const done_event_; | 496 rtc::Event* const done_event_; |
| 502 SendStatisticsProxy* const stats_proxy_; | 497 SendStatisticsProxy* const stats_proxy_; |
| 503 ViEEncoder* const vie_encoder_; | 498 ViEEncoder* const vie_encoder_; |
| 504 CallStats* const call_stats_; | 499 CallStats* const call_stats_; |
| 505 RtpTransportControllerSendInterface* const transport_; | 500 RtpTransportControllerSendInterface* const transport_; |
| 506 BitrateAllocator* const bitrate_allocator_; | 501 BitrateAllocator* const bitrate_allocator_; |
| 507 SendDelayStats* const send_delay_stats_; | 502 SendDelayStats* const send_delay_stats_; |
| 508 VieRemb* const remb_; | |
| 509 RtcEventLog* const event_log_; | 503 RtcEventLog* const event_log_; |
| 510 const VideoSendStream::Config* config_; | 504 const VideoSendStream::Config* config_; |
| 511 int initial_encoder_max_bitrate_; | 505 int initial_encoder_max_bitrate_; |
| 512 std::map<uint32_t, RtpState> suspended_ssrcs_; | 506 std::map<uint32_t, RtpState> suspended_ssrcs_; |
| 513 }; | 507 }; |
| 514 | 508 |
| 515 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask { | 509 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask { |
| 516 public: | 510 public: |
| 517 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map, | 511 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map, |
| 518 std::unique_ptr<VideoSendStreamImpl> send_stream, | 512 std::unique_ptr<VideoSendStreamImpl> send_stream, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 }; | 606 }; |
| 613 | 607 |
| 614 VideoSendStream::VideoSendStream( | 608 VideoSendStream::VideoSendStream( |
| 615 int num_cpu_cores, | 609 int num_cpu_cores, |
| 616 ProcessThread* module_process_thread, | 610 ProcessThread* module_process_thread, |
| 617 rtc::TaskQueue* worker_queue, | 611 rtc::TaskQueue* worker_queue, |
| 618 CallStats* call_stats, | 612 CallStats* call_stats, |
| 619 RtpTransportControllerSendInterface* transport, | 613 RtpTransportControllerSendInterface* transport, |
| 620 BitrateAllocator* bitrate_allocator, | 614 BitrateAllocator* bitrate_allocator, |
| 621 SendDelayStats* send_delay_stats, | 615 SendDelayStats* send_delay_stats, |
| 622 VieRemb* remb, | |
| 623 RtcEventLog* event_log, | 616 RtcEventLog* event_log, |
| 624 VideoSendStream::Config config, | 617 VideoSendStream::Config config, |
| 625 VideoEncoderConfig encoder_config, | 618 VideoEncoderConfig encoder_config, |
| 626 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 619 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 627 : worker_queue_(worker_queue), | 620 : worker_queue_(worker_queue), |
| 628 thread_sync_event_(false /* manual_reset */, false), | 621 thread_sync_event_(false /* manual_reset */, false), |
| 629 stats_proxy_(Clock::GetRealTimeClock(), | 622 stats_proxy_(Clock::GetRealTimeClock(), |
| 630 config, | 623 config, |
| 631 encoder_config.content_type), | 624 encoder_config.content_type), |
| 632 config_(std::move(config)), | 625 config_(std::move(config)), |
| 633 content_type_(encoder_config.content_type) { | 626 content_type_(encoder_config.content_type) { |
| 634 vie_encoder_.reset(new ViEEncoder( | 627 vie_encoder_.reset(new ViEEncoder( |
| 635 num_cpu_cores, &stats_proxy_, config_.encoder_settings, | 628 num_cpu_cores, &stats_proxy_, config_.encoder_settings, |
| 636 config_.pre_encode_callback, config_.post_encode_callback)); | 629 config_.pre_encode_callback, config_.post_encode_callback)); |
| 637 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( | 630 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( |
| 638 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), | 631 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), |
| 639 module_process_thread, call_stats, transport, bitrate_allocator, | 632 module_process_thread, call_stats, transport, bitrate_allocator, |
| 640 send_delay_stats, remb, event_log, &config_, | 633 send_delay_stats, event_log, &config_, |
| 641 encoder_config.max_bitrate_bps, suspended_ssrcs))); | 634 encoder_config.max_bitrate_bps, suspended_ssrcs))); |
| 642 | 635 |
| 643 // Wait for ConstructionTask to complete so that |send_stream_| can be used. | 636 // Wait for ConstructionTask to complete so that |send_stream_| can be used. |
| 644 // |module_process_thread| must be registered and deregistered on the thread | 637 // |module_process_thread| must be registered and deregistered on the thread |
| 645 // it was created on. | 638 // it was created on. |
| 646 thread_sync_event_.Wait(rtc::Event::kForever); | 639 thread_sync_event_.Wait(rtc::Event::kForever); |
| 647 send_stream_->RegisterProcessThread(module_process_thread); | 640 send_stream_->RegisterProcessThread(module_process_thread); |
| 648 // TODO(sprang): Enable this also for regular video calls if it works well. | 641 // TODO(sprang): Enable this also for regular video calls if it works well. |
| 649 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { | 642 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { |
| 650 // Only signal target bitrate for screenshare streams, for now. | 643 // Only signal target bitrate for screenshare streams, for now. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 send_stream_->EnableEncodedFrameRecording(files, byte_limit); | 738 send_stream_->EnableEncodedFrameRecording(files, byte_limit); |
| 746 } | 739 } |
| 747 | 740 |
| 748 VideoSendStreamImpl::VideoSendStreamImpl( | 741 VideoSendStreamImpl::VideoSendStreamImpl( |
| 749 SendStatisticsProxy* stats_proxy, | 742 SendStatisticsProxy* stats_proxy, |
| 750 rtc::TaskQueue* worker_queue, | 743 rtc::TaskQueue* worker_queue, |
| 751 CallStats* call_stats, | 744 CallStats* call_stats, |
| 752 RtpTransportControllerSendInterface* transport, | 745 RtpTransportControllerSendInterface* transport, |
| 753 BitrateAllocator* bitrate_allocator, | 746 BitrateAllocator* bitrate_allocator, |
| 754 SendDelayStats* send_delay_stats, | 747 SendDelayStats* send_delay_stats, |
| 755 VieRemb* remb, | |
| 756 ViEEncoder* vie_encoder, | 748 ViEEncoder* vie_encoder, |
| 757 RtcEventLog* event_log, | 749 RtcEventLog* event_log, |
| 758 const VideoSendStream::Config* config, | 750 const VideoSendStream::Config* config, |
| 759 int initial_encoder_max_bitrate, | 751 int initial_encoder_max_bitrate, |
| 760 std::map<uint32_t, RtpState> suspended_ssrcs) | 752 std::map<uint32_t, RtpState> suspended_ssrcs) |
| 761 : send_side_bwe_with_overhead_( | 753 : send_side_bwe_with_overhead_( |
| 762 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), | 754 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), |
| 763 stats_proxy_(stats_proxy), | 755 stats_proxy_(stats_proxy), |
| 764 config_(config), | 756 config_(config), |
| 765 suspended_ssrcs_(std::move(suspended_ssrcs)), | 757 suspended_ssrcs_(std::move(suspended_ssrcs)), |
| 766 module_process_thread_(nullptr), | 758 module_process_thread_(nullptr), |
| 767 worker_queue_(worker_queue), | 759 worker_queue_(worker_queue), |
| 768 check_encoder_activity_task_(nullptr), | 760 check_encoder_activity_task_(nullptr), |
| 769 call_stats_(call_stats), | 761 call_stats_(call_stats), |
| 770 transport_(transport), | 762 transport_(transport), |
| 771 bitrate_allocator_(bitrate_allocator), | 763 bitrate_allocator_(bitrate_allocator), |
| 772 remb_(remb), | |
| 773 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), | 764 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), |
| 774 max_padding_bitrate_(0), | 765 max_padding_bitrate_(0), |
| 775 encoder_min_bitrate_bps_(0), | 766 encoder_min_bitrate_bps_(0), |
| 776 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), | 767 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), |
| 777 encoder_target_rate_bps_(0), | 768 encoder_target_rate_bps_(0), |
| 778 vie_encoder_(vie_encoder), | 769 vie_encoder_(vie_encoder), |
| 779 encoder_feedback_(Clock::GetRealTimeClock(), | 770 encoder_feedback_(Clock::GetRealTimeClock(), |
| 780 config_->rtp.ssrcs, | 771 config_->rtp.ssrcs, |
| 781 vie_encoder), | 772 vie_encoder), |
| 782 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), | 773 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 801 weak_ptr_factory_(this), | 792 weak_ptr_factory_(this), |
| 802 overhead_bytes_per_packet_(0), | 793 overhead_bytes_per_packet_(0), |
| 803 transport_overhead_bytes_per_packet_(0) { | 794 transport_overhead_bytes_per_packet_(0) { |
| 804 RTC_DCHECK_RUN_ON(worker_queue_); | 795 RTC_DCHECK_RUN_ON(worker_queue_); |
| 805 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); | 796 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); |
| 806 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 797 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
| 807 module_process_thread_checker_.DetachFromThread(); | 798 module_process_thread_checker_.DetachFromThread(); |
| 808 | 799 |
| 809 RTC_DCHECK(!config_->rtp.ssrcs.empty()); | 800 RTC_DCHECK(!config_->rtp.ssrcs.empty()); |
| 810 RTC_DCHECK(call_stats_); | 801 RTC_DCHECK(call_stats_); |
| 811 RTC_DCHECK(remb_); | |
| 812 RTC_DCHECK(transport_); | 802 RTC_DCHECK(transport_); |
| 813 RTC_DCHECK(transport_->send_side_cc()); | 803 RTC_DCHECK(transport_->send_side_cc()); |
| 814 | 804 |
| 815 transport->send_side_cc()->EnablePeriodicAlrProbing( | 805 transport->send_side_cc()->EnablePeriodicAlrProbing( |
| 816 config_->periodic_alr_bandwidth_probing); | 806 config_->periodic_alr_bandwidth_probing); |
| 817 | 807 |
| 818 // RTP/RTCP initialization. | 808 // RTP/RTCP initialization. |
| 819 | 809 |
| 820 // We add the highest spatial layer first to ensure it'll be prioritized | 810 // We add the highest spatial layer first to ensure it'll be prioritized |
| 821 // when sending padding, with the hope that the packet rate will be smaller, | 811 // when sending padding, with the hope that the packet rate will be smaller, |
| 822 // and that it's more important to protect than the lower layers. | 812 // and that it's more important to protect than the lower layers. |
| 823 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 813 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 824 transport->packet_router()->AddSendRtpModule(rtp_rtcp); | 814 transport->packet_router()->AddSendRtpModule(rtp_rtcp); |
| 825 | 815 |
| 826 for (size_t i = 0; i < config_->rtp.extensions.size(); ++i) { | 816 for (size_t i = 0; i < config_->rtp.extensions.size(); ++i) { |
| 827 const std::string& extension = config_->rtp.extensions[i].uri; | 817 const std::string& extension = config_->rtp.extensions[i].uri; |
| 828 int id = config_->rtp.extensions[i].id; | 818 int id = config_->rtp.extensions[i].id; |
| 829 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 819 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 830 RTC_DCHECK_GE(id, 1); | 820 RTC_DCHECK_GE(id, 1); |
| 831 RTC_DCHECK_LE(id, 14); | 821 RTC_DCHECK_LE(id, 14); |
| 832 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); | 822 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); |
| 833 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 823 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 834 RTC_CHECK_EQ(0, rtp_rtcp->RegisterSendRtpHeaderExtension( | 824 RTC_CHECK_EQ(0, rtp_rtcp->RegisterSendRtpHeaderExtension( |
| 835 StringToRtpExtensionType(extension), id)); | 825 StringToRtpExtensionType(extension), id)); |
| 836 } | 826 } |
| 837 } | 827 } |
| 838 | 828 |
| 839 remb_->AddRembSender(rtp_rtcp_modules_[0]); | |
| 840 rtp_rtcp_modules_[0]->SetREMBStatus(true); | |
| 841 | |
| 842 ConfigureProtection(); | 829 ConfigureProtection(); |
| 843 ConfigureSsrcs(); | 830 ConfigureSsrcs(); |
| 844 | 831 |
| 845 // TODO(pbos): Should we set CNAME on all RTP modules? | 832 // TODO(pbos): Should we set CNAME on all RTP modules? |
| 846 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); | 833 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); |
| 847 | 834 |
| 848 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 835 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 849 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); | 836 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); |
| 850 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_); | 837 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_); |
| 851 rtp_rtcp->SetMaxRtpPacketSize(config_->rtp.max_packet_size); | 838 rtp_rtcp->SetMaxRtpPacketSize(config_->rtp.max_packet_size); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 876 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 890 module_process_thread_->DeRegisterModule(rtp_rtcp); | 877 module_process_thread_->DeRegisterModule(rtp_rtcp); |
| 891 } | 878 } |
| 892 | 879 |
| 893 VideoSendStreamImpl::~VideoSendStreamImpl() { | 880 VideoSendStreamImpl::~VideoSendStreamImpl() { |
| 894 RTC_DCHECK_RUN_ON(worker_queue_); | 881 RTC_DCHECK_RUN_ON(worker_queue_); |
| 895 RTC_DCHECK(!payload_router_.IsActive()) | 882 RTC_DCHECK(!payload_router_.IsActive()) |
| 896 << "VideoSendStreamImpl::Stop not called"; | 883 << "VideoSendStreamImpl::Stop not called"; |
| 897 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); | 884 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); |
| 898 | 885 |
| 899 rtp_rtcp_modules_[0]->SetREMBStatus(false); | |
| 900 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | |
| 901 | |
| 902 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 886 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 903 transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp); | 887 transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp); |
| 904 delete rtp_rtcp; | 888 delete rtp_rtcp; |
| 905 } | 889 } |
| 906 } | 890 } |
| 907 | 891 |
| 908 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { | 892 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 909 // Runs on a network thread. | 893 // Runs on a network thread. |
| 910 RTC_DCHECK(!worker_queue_->IsCurrent()); | 894 RTC_DCHECK(!worker_queue_->IsCurrent()); |
| 911 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 895 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 std::min(config_->rtp.max_packet_size, | 1322 std::min(config_->rtp.max_packet_size, |
| 1339 kPathMTU - transport_overhead_bytes_per_packet_); | 1323 kPathMTU - transport_overhead_bytes_per_packet_); |
| 1340 | 1324 |
| 1341 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1325 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 1342 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1326 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
| 1343 } | 1327 } |
| 1344 } | 1328 } |
| 1345 | 1329 |
| 1346 } // namespace internal | 1330 } // namespace internal |
| 1347 } // namespace webrtc | 1331 } // namespace webrtc |
| OLD | NEW |