Chromium Code Reviews| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 public webrtc::VCMProtectionCallback, | 321 public webrtc::VCMProtectionCallback, |
| 323 public ViEEncoder::EncoderSink, | 322 public ViEEncoder::EncoderSink, |
| 324 public VideoBitrateAllocationObserver { | 323 public VideoBitrateAllocationObserver { |
| 325 public: | 324 public: |
| 326 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, | 325 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
| 327 rtc::TaskQueue* worker_queue, | 326 rtc::TaskQueue* worker_queue, |
| 328 CallStats* call_stats, | 327 CallStats* call_stats, |
| 329 RtpTransportControllerSendInterface* transport, | 328 RtpTransportControllerSendInterface* transport, |
| 330 BitrateAllocator* bitrate_allocator, | 329 BitrateAllocator* bitrate_allocator, |
| 331 SendDelayStats* send_delay_stats, | 330 SendDelayStats* send_delay_stats, |
| 332 VieRemb* remb, | |
| 333 ViEEncoder* vie_encoder, | 331 ViEEncoder* vie_encoder, |
| 334 RtcEventLog* event_log, | 332 RtcEventLog* event_log, |
| 335 const VideoSendStream::Config* config, | 333 const VideoSendStream::Config* config, |
| 336 int initial_encoder_max_bitrate, | 334 int initial_encoder_max_bitrate, |
| 337 std::map<uint32_t, RtpState> suspended_ssrcs); | 335 std::map<uint32_t, RtpState> suspended_ssrcs); |
| 338 ~VideoSendStreamImpl() override; | 336 ~VideoSendStreamImpl() override; |
| 339 | 337 |
| 340 // RegisterProcessThread register |module_process_thread| with those objects | 338 // RegisterProcessThread register |module_process_thread| with those objects |
| 341 // that use it. Registration has to happen on the thread were | 339 // that use it. Registration has to happen on the thread were |
| 342 // |module_process_thread| was created (libjingle's worker thread). | 340 // |module_process_thread| was created (libjingle's worker thread). |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 rtc::ThreadChecker module_process_thread_checker_; | 404 rtc::ThreadChecker module_process_thread_checker_; |
| 407 rtc::TaskQueue* const worker_queue_; | 405 rtc::TaskQueue* const worker_queue_; |
| 408 | 406 |
| 409 rtc::CriticalSection encoder_activity_crit_sect_; | 407 rtc::CriticalSection encoder_activity_crit_sect_; |
| 410 CheckEncoderActivityTask* check_encoder_activity_task_ | 408 CheckEncoderActivityTask* check_encoder_activity_task_ |
| 411 GUARDED_BY(encoder_activity_crit_sect_); | 409 GUARDED_BY(encoder_activity_crit_sect_); |
| 412 | 410 |
| 413 CallStats* const call_stats_; | 411 CallStats* const call_stats_; |
| 414 RtpTransportControllerSendInterface* const transport_; | 412 RtpTransportControllerSendInterface* const transport_; |
| 415 BitrateAllocator* const bitrate_allocator_; | 413 BitrateAllocator* const bitrate_allocator_; |
| 416 VieRemb* const remb_; | |
| 417 | 414 |
| 418 // TODO(brandtr): Move ownership to PayloadRouter. | 415 // TODO(brandtr): Move ownership to PayloadRouter. |
| 419 std::unique_ptr<FlexfecSender> flexfec_sender_; | 416 std::unique_ptr<FlexfecSender> flexfec_sender_; |
| 420 | 417 |
| 421 rtc::CriticalSection ivf_writers_crit_; | 418 rtc::CriticalSection ivf_writers_crit_; |
| 422 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( | 419 std::unique_ptr<IvfFileWriter> file_writers_[kMaxSimulcastStreams] GUARDED_BY( |
| 423 ivf_writers_crit_); | 420 ivf_writers_crit_); |
| 424 | 421 |
| 425 int max_padding_bitrate_; | 422 int max_padding_bitrate_; |
| 426 int encoder_min_bitrate_bps_; | 423 int encoder_min_bitrate_bps_; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 455 public: | 452 public: |
| 456 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, | 453 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, |
| 457 rtc::Event* done_event, | 454 rtc::Event* done_event, |
| 458 SendStatisticsProxy* stats_proxy, | 455 SendStatisticsProxy* stats_proxy, |
| 459 ViEEncoder* vie_encoder, | 456 ViEEncoder* vie_encoder, |
| 460 ProcessThread* module_process_thread, | 457 ProcessThread* module_process_thread, |
| 461 CallStats* call_stats, | 458 CallStats* call_stats, |
| 462 RtpTransportControllerSendInterface* transport, | 459 RtpTransportControllerSendInterface* transport, |
| 463 BitrateAllocator* bitrate_allocator, | 460 BitrateAllocator* bitrate_allocator, |
| 464 SendDelayStats* send_delay_stats, | 461 SendDelayStats* send_delay_stats, |
| 465 VieRemb* remb, | |
| 466 RtcEventLog* event_log, | 462 RtcEventLog* event_log, |
| 467 const VideoSendStream::Config* config, | 463 const VideoSendStream::Config* config, |
| 468 int initial_encoder_max_bitrate, | 464 int initial_encoder_max_bitrate, |
| 469 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 465 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 470 : send_stream_(send_stream), | 466 : send_stream_(send_stream), |
| 471 done_event_(done_event), | 467 done_event_(done_event), |
| 472 stats_proxy_(stats_proxy), | 468 stats_proxy_(stats_proxy), |
| 473 vie_encoder_(vie_encoder), | 469 vie_encoder_(vie_encoder), |
| 474 call_stats_(call_stats), | 470 call_stats_(call_stats), |
| 475 transport_(transport), | 471 transport_(transport), |
| 476 bitrate_allocator_(bitrate_allocator), | 472 bitrate_allocator_(bitrate_allocator), |
| 477 send_delay_stats_(send_delay_stats), | 473 send_delay_stats_(send_delay_stats), |
| 478 remb_(remb), | |
| 479 event_log_(event_log), | 474 event_log_(event_log), |
| 480 config_(config), | 475 config_(config), |
| 481 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), | 476 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), |
| 482 suspended_ssrcs_(suspended_ssrcs) {} | 477 suspended_ssrcs_(suspended_ssrcs) {} |
| 483 | 478 |
| 484 ~ConstructionTask() override { done_event_->Set(); } | 479 ~ConstructionTask() override { done_event_->Set(); } |
| 485 | 480 |
| 486 private: | 481 private: |
| 487 bool Run() override { | 482 bool Run() override { |
| 488 send_stream_->reset(new VideoSendStreamImpl( | 483 send_stream_->reset(new VideoSendStreamImpl( |
| 489 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, | 484 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, |
| 490 bitrate_allocator_, send_delay_stats_, remb_, vie_encoder_, event_log_, | 485 bitrate_allocator_, send_delay_stats_, vie_encoder_, event_log_, |
| 491 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); | 486 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); |
| 492 return true; | 487 return true; |
| 493 } | 488 } |
| 494 | 489 |
| 495 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; | 490 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; |
| 496 rtc::Event* const done_event_; | 491 rtc::Event* const done_event_; |
| 497 SendStatisticsProxy* const stats_proxy_; | 492 SendStatisticsProxy* const stats_proxy_; |
| 498 ViEEncoder* const vie_encoder_; | 493 ViEEncoder* const vie_encoder_; |
| 499 CallStats* const call_stats_; | 494 CallStats* const call_stats_; |
| 500 RtpTransportControllerSendInterface* const transport_; | 495 RtpTransportControllerSendInterface* const transport_; |
| 501 BitrateAllocator* const bitrate_allocator_; | 496 BitrateAllocator* const bitrate_allocator_; |
| 502 SendDelayStats* const send_delay_stats_; | 497 SendDelayStats* const send_delay_stats_; |
| 503 VieRemb* const remb_; | |
| 504 RtcEventLog* const event_log_; | 498 RtcEventLog* const event_log_; |
| 505 const VideoSendStream::Config* config_; | 499 const VideoSendStream::Config* config_; |
| 506 int initial_encoder_max_bitrate_; | 500 int initial_encoder_max_bitrate_; |
| 507 std::map<uint32_t, RtpState> suspended_ssrcs_; | 501 std::map<uint32_t, RtpState> suspended_ssrcs_; |
| 508 }; | 502 }; |
| 509 | 503 |
| 510 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask { | 504 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask { |
| 511 public: | 505 public: |
| 512 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map, | 506 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map, |
| 513 std::unique_ptr<VideoSendStreamImpl> send_stream, | 507 std::unique_ptr<VideoSendStreamImpl> send_stream, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 }; | 601 }; |
| 608 | 602 |
| 609 VideoSendStream::VideoSendStream( | 603 VideoSendStream::VideoSendStream( |
| 610 int num_cpu_cores, | 604 int num_cpu_cores, |
| 611 ProcessThread* module_process_thread, | 605 ProcessThread* module_process_thread, |
| 612 rtc::TaskQueue* worker_queue, | 606 rtc::TaskQueue* worker_queue, |
| 613 CallStats* call_stats, | 607 CallStats* call_stats, |
| 614 RtpTransportControllerSendInterface* transport, | 608 RtpTransportControllerSendInterface* transport, |
| 615 BitrateAllocator* bitrate_allocator, | 609 BitrateAllocator* bitrate_allocator, |
| 616 SendDelayStats* send_delay_stats, | 610 SendDelayStats* send_delay_stats, |
| 617 VieRemb* remb, | |
| 618 RtcEventLog* event_log, | 611 RtcEventLog* event_log, |
| 619 VideoSendStream::Config config, | 612 VideoSendStream::Config config, |
| 620 VideoEncoderConfig encoder_config, | 613 VideoEncoderConfig encoder_config, |
| 621 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 614 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 622 : worker_queue_(worker_queue), | 615 : worker_queue_(worker_queue), |
| 623 thread_sync_event_(false /* manual_reset */, false), | 616 thread_sync_event_(false /* manual_reset */, false), |
| 624 stats_proxy_(Clock::GetRealTimeClock(), | 617 stats_proxy_(Clock::GetRealTimeClock(), |
| 625 config, | 618 config, |
| 626 encoder_config.content_type), | 619 encoder_config.content_type), |
| 627 config_(std::move(config)), | 620 config_(std::move(config)), |
| 628 content_type_(encoder_config.content_type) { | 621 content_type_(encoder_config.content_type) { |
| 629 vie_encoder_.reset(new ViEEncoder( | 622 vie_encoder_.reset(new ViEEncoder( |
| 630 num_cpu_cores, &stats_proxy_, config_.encoder_settings, | 623 num_cpu_cores, &stats_proxy_, config_.encoder_settings, |
| 631 config_.pre_encode_callback, config_.post_encode_callback)); | 624 config_.pre_encode_callback, config_.post_encode_callback)); |
| 632 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( | 625 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( |
| 633 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), | 626 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), |
| 634 module_process_thread, call_stats, transport, bitrate_allocator, | 627 module_process_thread, call_stats, transport, bitrate_allocator, |
| 635 send_delay_stats, remb, event_log, &config_, | 628 send_delay_stats, event_log, &config_, |
| 636 encoder_config.max_bitrate_bps, suspended_ssrcs))); | 629 encoder_config.max_bitrate_bps, suspended_ssrcs))); |
| 637 | 630 |
| 638 // Wait for ConstructionTask to complete so that |send_stream_| can be used. | 631 // Wait for ConstructionTask to complete so that |send_stream_| can be used. |
| 639 // |module_process_thread| must be registered and deregistered on the thread | 632 // |module_process_thread| must be registered and deregistered on the thread |
| 640 // it was created on. | 633 // it was created on. |
| 641 thread_sync_event_.Wait(rtc::Event::kForever); | 634 thread_sync_event_.Wait(rtc::Event::kForever); |
| 642 send_stream_->RegisterProcessThread(module_process_thread); | 635 send_stream_->RegisterProcessThread(module_process_thread); |
| 643 // TODO(sprang): Enable this also for regular video calls if it works well. | 636 // TODO(sprang): Enable this also for regular video calls if it works well. |
| 644 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { | 637 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { |
| 645 // Only signal target bitrate for screenshare streams, for now. | 638 // Only signal target bitrate for screenshare streams, for now. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 send_stream_->EnableEncodedFrameRecording(files, byte_limit); | 733 send_stream_->EnableEncodedFrameRecording(files, byte_limit); |
| 741 } | 734 } |
| 742 | 735 |
| 743 VideoSendStreamImpl::VideoSendStreamImpl( | 736 VideoSendStreamImpl::VideoSendStreamImpl( |
| 744 SendStatisticsProxy* stats_proxy, | 737 SendStatisticsProxy* stats_proxy, |
| 745 rtc::TaskQueue* worker_queue, | 738 rtc::TaskQueue* worker_queue, |
| 746 CallStats* call_stats, | 739 CallStats* call_stats, |
| 747 RtpTransportControllerSendInterface* transport, | 740 RtpTransportControllerSendInterface* transport, |
| 748 BitrateAllocator* bitrate_allocator, | 741 BitrateAllocator* bitrate_allocator, |
| 749 SendDelayStats* send_delay_stats, | 742 SendDelayStats* send_delay_stats, |
| 750 VieRemb* remb, | |
| 751 ViEEncoder* vie_encoder, | 743 ViEEncoder* vie_encoder, |
| 752 RtcEventLog* event_log, | 744 RtcEventLog* event_log, |
| 753 const VideoSendStream::Config* config, | 745 const VideoSendStream::Config* config, |
| 754 int initial_encoder_max_bitrate, | 746 int initial_encoder_max_bitrate, |
| 755 std::map<uint32_t, RtpState> suspended_ssrcs) | 747 std::map<uint32_t, RtpState> suspended_ssrcs) |
| 756 : send_side_bwe_with_overhead_( | 748 : send_side_bwe_with_overhead_( |
| 757 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), | 749 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), |
| 758 stats_proxy_(stats_proxy), | 750 stats_proxy_(stats_proxy), |
| 759 config_(config), | 751 config_(config), |
| 760 suspended_ssrcs_(std::move(suspended_ssrcs)), | 752 suspended_ssrcs_(std::move(suspended_ssrcs)), |
| 761 module_process_thread_(nullptr), | 753 module_process_thread_(nullptr), |
| 762 worker_queue_(worker_queue), | 754 worker_queue_(worker_queue), |
| 763 check_encoder_activity_task_(nullptr), | 755 check_encoder_activity_task_(nullptr), |
| 764 call_stats_(call_stats), | 756 call_stats_(call_stats), |
| 765 transport_(transport), | 757 transport_(transport), |
| 766 bitrate_allocator_(bitrate_allocator), | 758 bitrate_allocator_(bitrate_allocator), |
| 767 remb_(remb), | |
| 768 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), | 759 flexfec_sender_(MaybeCreateFlexfecSender(*config_)), |
| 769 max_padding_bitrate_(0), | 760 max_padding_bitrate_(0), |
| 770 encoder_min_bitrate_bps_(0), | 761 encoder_min_bitrate_bps_(0), |
| 771 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), | 762 encoder_max_bitrate_bps_(initial_encoder_max_bitrate), |
| 772 encoder_target_rate_bps_(0), | 763 encoder_target_rate_bps_(0), |
| 773 vie_encoder_(vie_encoder), | 764 vie_encoder_(vie_encoder), |
| 774 encoder_feedback_(Clock::GetRealTimeClock(), | 765 encoder_feedback_(Clock::GetRealTimeClock(), |
| 775 config_->rtp.ssrcs, | 766 config_->rtp.ssrcs, |
| 776 vie_encoder), | 767 vie_encoder), |
| 777 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), | 768 protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 796 weak_ptr_factory_(this), | 787 weak_ptr_factory_(this), |
| 797 overhead_bytes_per_packet_(0), | 788 overhead_bytes_per_packet_(0), |
| 798 transport_overhead_bytes_per_packet_(0) { | 789 transport_overhead_bytes_per_packet_(0) { |
| 799 RTC_DCHECK_RUN_ON(worker_queue_); | 790 RTC_DCHECK_RUN_ON(worker_queue_); |
| 800 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); | 791 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); |
| 801 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 792 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
| 802 module_process_thread_checker_.DetachFromThread(); | 793 module_process_thread_checker_.DetachFromThread(); |
| 803 | 794 |
| 804 RTC_DCHECK(!config_->rtp.ssrcs.empty()); | 795 RTC_DCHECK(!config_->rtp.ssrcs.empty()); |
| 805 RTC_DCHECK(call_stats_); | 796 RTC_DCHECK(call_stats_); |
| 806 RTC_DCHECK(remb_); | |
| 807 RTC_DCHECK(transport_); | 797 RTC_DCHECK(transport_); |
| 808 RTC_DCHECK(transport_->send_side_cc()); | 798 RTC_DCHECK(transport_->send_side_cc()); |
| 809 | 799 |
| 810 transport->send_side_cc()->EnablePeriodicAlrProbing( | 800 transport->send_side_cc()->EnablePeriodicAlrProbing( |
| 811 config_->periodic_alr_bandwidth_probing); | 801 config_->periodic_alr_bandwidth_probing); |
| 812 | 802 |
| 813 // RTP/RTCP initialization. | 803 // RTP/RTCP initialization. |
| 814 | 804 |
| 815 // We add the highest spatial layer first to ensure it'll be prioritized | 805 // We add the highest spatial layer first to ensure it'll be prioritized |
| 816 // when sending padding, with the hope that the packet rate will be smaller, | 806 // when sending padding, with the hope that the packet rate will be smaller, |
| 817 // and that it's more important to protect than the lower layers. | 807 // and that it's more important to protect than the lower layers. |
| 818 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 808 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 819 transport->packet_router()->AddSendRtpModule(rtp_rtcp); | 809 transport->packet_router()->AddSendRtpModule(rtp_rtcp); |
| 820 | 810 |
| 821 for (size_t i = 0; i < config_->rtp.extensions.size(); ++i) { | 811 for (size_t i = 0; i < config_->rtp.extensions.size(); ++i) { |
| 822 const std::string& extension = config_->rtp.extensions[i].uri; | 812 const std::string& extension = config_->rtp.extensions[i].uri; |
| 823 int id = config_->rtp.extensions[i].id; | 813 int id = config_->rtp.extensions[i].id; |
| 824 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 814 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
| 825 RTC_DCHECK_GE(id, 1); | 815 RTC_DCHECK_GE(id, 1); |
| 826 RTC_DCHECK_LE(id, 14); | 816 RTC_DCHECK_LE(id, 14); |
| 827 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); | 817 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); |
| 828 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 818 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 829 RTC_CHECK_EQ(0, rtp_rtcp->RegisterSendRtpHeaderExtension( | 819 RTC_CHECK_EQ(0, rtp_rtcp->RegisterSendRtpHeaderExtension( |
| 830 StringToRtpExtensionType(extension), id)); | 820 StringToRtpExtensionType(extension), id)); |
| 831 } | 821 } |
| 832 } | 822 } |
| 833 | 823 |
| 834 remb_->AddRembSender(rtp_rtcp_modules_[0]); | |
| 835 rtp_rtcp_modules_[0]->SetREMBStatus(true); | 824 rtp_rtcp_modules_[0]->SetREMBStatus(true); |
| 836 | 825 |
| 837 ConfigureProtection(); | 826 ConfigureProtection(); |
| 838 ConfigureSsrcs(); | 827 ConfigureSsrcs(); |
| 839 | 828 |
| 840 // TODO(pbos): Should we set CNAME on all RTP modules? | 829 // TODO(pbos): Should we set CNAME on all RTP modules? |
| 841 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); | 830 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); |
| 842 | 831 |
| 843 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 832 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 844 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); | 833 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 873 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 885 module_process_thread_->DeRegisterModule(rtp_rtcp); | 874 module_process_thread_->DeRegisterModule(rtp_rtcp); |
| 886 } | 875 } |
| 887 | 876 |
| 888 VideoSendStreamImpl::~VideoSendStreamImpl() { | 877 VideoSendStreamImpl::~VideoSendStreamImpl() { |
| 889 RTC_DCHECK_RUN_ON(worker_queue_); | 878 RTC_DCHECK_RUN_ON(worker_queue_); |
| 890 RTC_DCHECK(!payload_router_.IsActive()) | 879 RTC_DCHECK(!payload_router_.IsActive()) |
| 891 << "VideoSendStreamImpl::Stop not called"; | 880 << "VideoSendStreamImpl::Stop not called"; |
| 892 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); | 881 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); |
| 893 | 882 |
| 883 // TODO(nisse): This looks pointless, since we're just about to | |
| 884 // delete the object? | |
|
stefan-webrtc
2017/04/03 12:31:51
Feel free to remove in that case. The only reason
nisse-webrtc
2017/04/03 14:45:02
I'll delete then.
| |
| 894 rtp_rtcp_modules_[0]->SetREMBStatus(false); | 885 rtp_rtcp_modules_[0]->SetREMBStatus(false); |
| 895 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | |
| 896 | 886 |
| 897 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 887 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 898 transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp); | 888 transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp); |
| 899 delete rtp_rtcp; | 889 delete rtp_rtcp; |
| 900 } | 890 } |
| 901 } | 891 } |
| 902 | 892 |
| 903 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { | 893 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 904 // Runs on a network thread. | 894 // Runs on a network thread. |
| 905 RTC_DCHECK(!worker_queue_->IsCurrent()); | 895 RTC_DCHECK(!worker_queue_->IsCurrent()); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1333 std::min(config_->rtp.max_packet_size, | 1323 std::min(config_->rtp.max_packet_size, |
| 1334 kPathMTU - transport_overhead_bytes_per_packet_); | 1324 kPathMTU - transport_overhead_bytes_per_packet_); |
| 1335 | 1325 |
| 1336 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1326 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 1337 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1327 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
| 1338 } | 1328 } |
| 1339 } | 1329 } |
| 1340 | 1330 |
| 1341 } // namespace internal | 1331 } // namespace internal |
| 1342 } // namespace webrtc | 1332 } // namespace webrtc |
| OLD | NEW |