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

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 2978503002: Move RTP keep-alive config from VideoSendStream::Config to Call::Config (Closed)
Patch Set: Typo in comment Created 3 years, 5 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
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webrtc/video/video_send_stream.h" 10 #include "webrtc/video/video_send_stream.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 rtc::TaskQueue* worker_queue, 342 rtc::TaskQueue* worker_queue,
343 CallStats* call_stats, 343 CallStats* call_stats,
344 RtpTransportControllerSendInterface* transport, 344 RtpTransportControllerSendInterface* transport,
345 BitrateAllocator* bitrate_allocator, 345 BitrateAllocator* bitrate_allocator,
346 SendDelayStats* send_delay_stats, 346 SendDelayStats* send_delay_stats,
347 ViEEncoder* vie_encoder, 347 ViEEncoder* vie_encoder,
348 RtcEventLog* event_log, 348 RtcEventLog* event_log,
349 const VideoSendStream::Config* config, 349 const VideoSendStream::Config* config,
350 int initial_encoder_max_bitrate, 350 int initial_encoder_max_bitrate,
351 std::map<uint32_t, RtpState> suspended_ssrcs, 351 std::map<uint32_t, RtpState> suspended_ssrcs,
352 VideoEncoderConfig::ContentType content_type); 352 VideoEncoderConfig::ContentType content_type,
353 const RtpKeepAliveConfig& keepalive_config);
353 ~VideoSendStreamImpl() override; 354 ~VideoSendStreamImpl() override;
354 355
355 // RegisterProcessThread register |module_process_thread| with those objects 356 // RegisterProcessThread register |module_process_thread| with those objects
356 // that use it. Registration has to happen on the thread were 357 // that use it. Registration has to happen on the thread were
357 // |module_process_thread| was created (libjingle's worker thread). 358 // |module_process_thread| was created (libjingle's worker thread).
358 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue, 359 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue,
359 // maybe |worker_queue|. 360 // maybe |worker_queue|.
360 void RegisterProcessThread(ProcessThread* module_process_thread); 361 void RegisterProcessThread(ProcessThread* module_process_thread);
361 void DeRegisterProcessThread(); 362 void DeRegisterProcessThread();
362 363
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 ViEEncoder* vie_encoder, 474 ViEEncoder* vie_encoder,
474 ProcessThread* module_process_thread, 475 ProcessThread* module_process_thread,
475 CallStats* call_stats, 476 CallStats* call_stats,
476 RtpTransportControllerSendInterface* transport, 477 RtpTransportControllerSendInterface* transport,
477 BitrateAllocator* bitrate_allocator, 478 BitrateAllocator* bitrate_allocator,
478 SendDelayStats* send_delay_stats, 479 SendDelayStats* send_delay_stats,
479 RtcEventLog* event_log, 480 RtcEventLog* event_log,
480 const VideoSendStream::Config* config, 481 const VideoSendStream::Config* config,
481 int initial_encoder_max_bitrate, 482 int initial_encoder_max_bitrate,
482 const std::map<uint32_t, RtpState>& suspended_ssrcs, 483 const std::map<uint32_t, RtpState>& suspended_ssrcs,
483 VideoEncoderConfig::ContentType content_type) 484 VideoEncoderConfig::ContentType content_type,
485 const RtpKeepAliveConfig& keepalive_config)
484 : send_stream_(send_stream), 486 : send_stream_(send_stream),
485 done_event_(done_event), 487 done_event_(done_event),
486 stats_proxy_(stats_proxy), 488 stats_proxy_(stats_proxy),
487 vie_encoder_(vie_encoder), 489 vie_encoder_(vie_encoder),
488 call_stats_(call_stats), 490 call_stats_(call_stats),
489 transport_(transport), 491 transport_(transport),
490 bitrate_allocator_(bitrate_allocator), 492 bitrate_allocator_(bitrate_allocator),
491 send_delay_stats_(send_delay_stats), 493 send_delay_stats_(send_delay_stats),
492 event_log_(event_log), 494 event_log_(event_log),
493 config_(config), 495 config_(config),
494 initial_encoder_max_bitrate_(initial_encoder_max_bitrate), 496 initial_encoder_max_bitrate_(initial_encoder_max_bitrate),
495 suspended_ssrcs_(suspended_ssrcs), 497 suspended_ssrcs_(suspended_ssrcs),
496 content_type_(content_type) {} 498 content_type_(content_type),
499 keepalive_config_(keepalive_config) {}
497 500
498 ~ConstructionTask() override { done_event_->Set(); } 501 ~ConstructionTask() override { done_event_->Set(); }
499 502
500 private: 503 private:
501 bool Run() override { 504 bool Run() override {
502 send_stream_->reset(new VideoSendStreamImpl( 505 send_stream_->reset(new VideoSendStreamImpl(
503 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, 506 stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_,
504 bitrate_allocator_, send_delay_stats_, vie_encoder_, event_log_, 507 bitrate_allocator_, send_delay_stats_, vie_encoder_, event_log_,
505 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_), 508 config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_),
506 content_type_)); 509 content_type_, keepalive_config_));
507 return true; 510 return true;
508 } 511 }
509 512
510 std::unique_ptr<VideoSendStreamImpl>* const send_stream_; 513 std::unique_ptr<VideoSendStreamImpl>* const send_stream_;
511 rtc::Event* const done_event_; 514 rtc::Event* const done_event_;
512 SendStatisticsProxy* const stats_proxy_; 515 SendStatisticsProxy* const stats_proxy_;
513 ViEEncoder* const vie_encoder_; 516 ViEEncoder* const vie_encoder_;
514 CallStats* const call_stats_; 517 CallStats* const call_stats_;
515 RtpTransportControllerSendInterface* const transport_; 518 RtpTransportControllerSendInterface* const transport_;
516 BitrateAllocator* const bitrate_allocator_; 519 BitrateAllocator* const bitrate_allocator_;
517 SendDelayStats* const send_delay_stats_; 520 SendDelayStats* const send_delay_stats_;
518 RtcEventLog* const event_log_; 521 RtcEventLog* const event_log_;
519 const VideoSendStream::Config* config_; 522 const VideoSendStream::Config* config_;
520 int initial_encoder_max_bitrate_; 523 int initial_encoder_max_bitrate_;
521 std::map<uint32_t, RtpState> suspended_ssrcs_; 524 std::map<uint32_t, RtpState> suspended_ssrcs_;
522 const VideoEncoderConfig::ContentType content_type_; 525 const VideoEncoderConfig::ContentType content_type_;
526 const RtpKeepAliveConfig& keepalive_config_;
523 }; 527 };
524 528
525 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask { 529 class VideoSendStream::DestructAndGetRtpStateTask : public rtc::QueuedTask {
526 public: 530 public:
527 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map, 531 DestructAndGetRtpStateTask(VideoSendStream::RtpStateMap* state_map,
528 std::unique_ptr<VideoSendStreamImpl> send_stream, 532 std::unique_ptr<VideoSendStreamImpl> send_stream,
529 rtc::Event* done_event) 533 rtc::Event* done_event)
530 : state_map_(state_map), 534 : state_map_(state_map),
531 send_stream_(std::move(send_stream)), 535 send_stream_(std::move(send_stream)),
532 done_event_(done_event) {} 536 done_event_(done_event) {}
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 int num_cpu_cores, 629 int num_cpu_cores,
626 ProcessThread* module_process_thread, 630 ProcessThread* module_process_thread,
627 rtc::TaskQueue* worker_queue, 631 rtc::TaskQueue* worker_queue,
628 CallStats* call_stats, 632 CallStats* call_stats,
629 RtpTransportControllerSendInterface* transport, 633 RtpTransportControllerSendInterface* transport,
630 BitrateAllocator* bitrate_allocator, 634 BitrateAllocator* bitrate_allocator,
631 SendDelayStats* send_delay_stats, 635 SendDelayStats* send_delay_stats,
632 RtcEventLog* event_log, 636 RtcEventLog* event_log,
633 VideoSendStream::Config config, 637 VideoSendStream::Config config,
634 VideoEncoderConfig encoder_config, 638 VideoEncoderConfig encoder_config,
635 const std::map<uint32_t, RtpState>& suspended_ssrcs) 639 const std::map<uint32_t, RtpState>& suspended_ssrcs,
640 const RtpKeepAliveConfig& keepalive_config)
636 : worker_queue_(worker_queue), 641 : worker_queue_(worker_queue),
637 thread_sync_event_(false /* manual_reset */, false), 642 thread_sync_event_(false /* manual_reset */, false),
638 stats_proxy_(Clock::GetRealTimeClock(), 643 stats_proxy_(Clock::GetRealTimeClock(),
639 config, 644 config,
640 encoder_config.content_type), 645 encoder_config.content_type),
641 config_(std::move(config)), 646 config_(std::move(config)),
642 content_type_(encoder_config.content_type) { 647 content_type_(encoder_config.content_type) {
643 vie_encoder_.reset( 648 vie_encoder_.reset(
644 new ViEEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings, 649 new ViEEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings,
645 config_.pre_encode_callback, config_.post_encode_callback, 650 config_.pre_encode_callback, config_.post_encode_callback,
646 std::unique_ptr<OveruseFrameDetector>())); 651 std::unique_ptr<OveruseFrameDetector>()));
647 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( 652 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask(
648 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), 653 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(),
649 module_process_thread, call_stats, transport, bitrate_allocator, 654 module_process_thread, call_stats, transport, bitrate_allocator,
650 send_delay_stats, event_log, &config_, encoder_config.max_bitrate_bps, 655 send_delay_stats, event_log, &config_, encoder_config.max_bitrate_bps,
651 suspended_ssrcs, encoder_config.content_type))); 656 suspended_ssrcs, encoder_config.content_type, keepalive_config)));
652 657
653 // Wait for ConstructionTask to complete so that |send_stream_| can be used. 658 // Wait for ConstructionTask to complete so that |send_stream_| can be used.
654 // |module_process_thread| must be registered and deregistered on the thread 659 // |module_process_thread| must be registered and deregistered on the thread
655 // it was created on. 660 // it was created on.
656 thread_sync_event_.Wait(rtc::Event::kForever); 661 thread_sync_event_.Wait(rtc::Event::kForever);
657 send_stream_->RegisterProcessThread(module_process_thread); 662 send_stream_->RegisterProcessThread(module_process_thread);
658 // TODO(sprang): Enable this also for regular video calls if it works well. 663 // TODO(sprang): Enable this also for regular video calls if it works well.
659 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) { 664 if (encoder_config.content_type == VideoEncoderConfig::ContentType::kScreen) {
660 // Only signal target bitrate for screenshare streams, for now. 665 // Only signal target bitrate for screenshare streams, for now.
661 vie_encoder_->SetBitrateObserver(send_stream_.get()); 666 vie_encoder_->SetBitrateObserver(send_stream_.get());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 rtc::TaskQueue* worker_queue, 765 rtc::TaskQueue* worker_queue,
761 CallStats* call_stats, 766 CallStats* call_stats,
762 RtpTransportControllerSendInterface* transport, 767 RtpTransportControllerSendInterface* transport,
763 BitrateAllocator* bitrate_allocator, 768 BitrateAllocator* bitrate_allocator,
764 SendDelayStats* send_delay_stats, 769 SendDelayStats* send_delay_stats,
765 ViEEncoder* vie_encoder, 770 ViEEncoder* vie_encoder,
766 RtcEventLog* event_log, 771 RtcEventLog* event_log,
767 const VideoSendStream::Config* config, 772 const VideoSendStream::Config* config,
768 int initial_encoder_max_bitrate, 773 int initial_encoder_max_bitrate,
769 std::map<uint32_t, RtpState> suspended_ssrcs, 774 std::map<uint32_t, RtpState> suspended_ssrcs,
770 VideoEncoderConfig::ContentType content_type) 775 VideoEncoderConfig::ContentType content_type,
776 const RtpKeepAliveConfig& keepalive_config)
771 : send_side_bwe_with_overhead_( 777 : send_side_bwe_with_overhead_(
772 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")), 778 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")),
773 stats_proxy_(stats_proxy), 779 stats_proxy_(stats_proxy),
774 config_(config), 780 config_(config),
775 suspended_ssrcs_(std::move(suspended_ssrcs)), 781 suspended_ssrcs_(std::move(suspended_ssrcs)),
776 module_process_thread_(nullptr), 782 module_process_thread_(nullptr),
777 worker_queue_(worker_queue), 783 worker_queue_(worker_queue),
778 check_encoder_activity_task_(nullptr), 784 check_encoder_activity_task_(nullptr),
779 call_stats_(call_stats), 785 call_stats_(call_stats),
780 transport_(transport), 786 transport_(transport),
(...skipping 17 matching lines...) Expand all
798 bandwidth_observer_.get(), 804 bandwidth_observer_.get(),
799 transport, 805 transport,
800 call_stats_->rtcp_rtt_stats(), 806 call_stats_->rtcp_rtt_stats(),
801 flexfec_sender_.get(), 807 flexfec_sender_.get(),
802 stats_proxy_, 808 stats_proxy_,
803 send_delay_stats, 809 send_delay_stats,
804 event_log, 810 event_log,
805 transport->send_side_cc()->GetRetransmissionRateLimiter(), 811 transport->send_side_cc()->GetRetransmissionRateLimiter(),
806 this, 812 this,
807 config_->rtp.ssrcs.size(), 813 config_->rtp.ssrcs.size(),
808 config_->rtp.keep_alive)), 814 keepalive_config)),
809 payload_router_(rtp_rtcp_modules_, 815 payload_router_(rtp_rtcp_modules_,
810 config_->encoder_settings.payload_type), 816 config_->encoder_settings.payload_type),
811 weak_ptr_factory_(this), 817 weak_ptr_factory_(this),
812 overhead_bytes_per_packet_(0), 818 overhead_bytes_per_packet_(0),
813 transport_overhead_bytes_per_packet_(0) { 819 transport_overhead_bytes_per_packet_(0) {
814 RTC_DCHECK_RUN_ON(worker_queue_); 820 RTC_DCHECK_RUN_ON(worker_queue_);
815 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); 821 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString();
816 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); 822 weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
817 module_process_thread_checker_.DetachFromThread(); 823 module_process_thread_checker_.DetachFromThread();
818 824
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 std::min(config_->rtp.max_packet_size, 1370 std::min(config_->rtp.max_packet_size,
1365 kPathMTU - transport_overhead_bytes_per_packet_); 1371 kPathMTU - transport_overhead_bytes_per_packet_);
1366 1372
1367 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 1373 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
1368 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); 1374 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size);
1369 } 1375 }
1370 } 1376 }
1371 1377
1372 } // namespace internal 1378 } // namespace internal
1373 } // namespace webrtc 1379 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698