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

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

Issue 2752233002: Split CongestionController into send- and receive-side classes. (Closed)
Patch Set: Added method ReceiveSideCongestionController::OnBitrateChanged. Created 3 years, 9 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 #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
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* congestion_controller,
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
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 congestion_controller_;
philipel 2017/03/20 16:48:19 Same here, WDYT about renaming this to |send_side_
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
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* congestion_controller,
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),
(...skipping 20 matching lines...) Expand all
494 send_delay_stats_, remb_, vie_encoder_, event_log_, config_, 494 send_delay_stats_, remb_, vie_encoder_, event_log_, config_,
495 initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); 495 initial_encoder_max_bitrate_, 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 congestion_controller_;
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
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* congestion_controller,
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),
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* congestion_controller,
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_(
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 std::min(config_->rtp.max_packet_size, 1341 std::min(config_->rtp.max_packet_size,
1342 kPathMTU - transport_overhead_bytes_per_packet_); 1342 kPathMTU - transport_overhead_bytes_per_packet_);
1343 1343
1344 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 1344 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
1345 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); 1345 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size);
1346 } 1346 }
1347 } 1347 }
1348 1348
1349 } // namespace internal 1349 } // namespace internal
1350 } // namespace webrtc 1350 } // namespace webrtc
OLDNEW
« webrtc/audio/audio_send_stream.h ('K') | « webrtc/video/video_send_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698