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

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

Issue 2061423003: Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 4 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
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 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Transport* outgoing_transport, 45 Transport* outgoing_transport,
46 RtcpIntraFrameObserver* intra_frame_callback, 46 RtcpIntraFrameObserver* intra_frame_callback,
47 RtcpBandwidthObserver* bandwidth_callback, 47 RtcpBandwidthObserver* bandwidth_callback,
48 TransportFeedbackObserver* transport_feedback_callback, 48 TransportFeedbackObserver* transport_feedback_callback,
49 RtcpRttStats* rtt_stats, 49 RtcpRttStats* rtt_stats,
50 RtpPacketSender* paced_sender, 50 RtpPacketSender* paced_sender,
51 TransportSequenceNumberAllocator* transport_sequence_number_allocator, 51 TransportSequenceNumberAllocator* transport_sequence_number_allocator,
52 SendStatisticsProxy* stats_proxy, 52 SendStatisticsProxy* stats_proxy,
53 SendDelayStats* send_delay_stats, 53 SendDelayStats* send_delay_stats,
54 RtcEventLog* event_log, 54 RtcEventLog* event_log,
55 RateLimiter* retransmission_rate_limiter,
55 size_t num_modules) { 56 size_t num_modules) {
56 RTC_DCHECK_GT(num_modules, 0u); 57 RTC_DCHECK_GT(num_modules, 0u);
57 RtpRtcp::Configuration configuration; 58 RtpRtcp::Configuration configuration;
58 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics; 59 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics;
59 configuration.audio = false; 60 configuration.audio = false;
60 configuration.receiver_only = false; 61 configuration.receiver_only = false;
61 configuration.receive_statistics = null_receive_statistics; 62 configuration.receive_statistics = null_receive_statistics;
62 configuration.outgoing_transport = outgoing_transport; 63 configuration.outgoing_transport = outgoing_transport;
63 configuration.intra_frame_callback = intra_frame_callback; 64 configuration.intra_frame_callback = intra_frame_callback;
64 configuration.bandwidth_callback = bandwidth_callback; 65 configuration.bandwidth_callback = bandwidth_callback;
65 configuration.transport_feedback_callback = transport_feedback_callback; 66 configuration.transport_feedback_callback = transport_feedback_callback;
66 configuration.rtt_stats = rtt_stats; 67 configuration.rtt_stats = rtt_stats;
67 configuration.rtcp_packet_type_counter_observer = stats_proxy; 68 configuration.rtcp_packet_type_counter_observer = stats_proxy;
68 configuration.paced_sender = paced_sender; 69 configuration.paced_sender = paced_sender;
69 configuration.transport_sequence_number_allocator = 70 configuration.transport_sequence_number_allocator =
70 transport_sequence_number_allocator; 71 transport_sequence_number_allocator;
71 configuration.send_bitrate_observer = stats_proxy; 72 configuration.send_bitrate_observer = stats_proxy;
72 configuration.send_frame_count_observer = stats_proxy; 73 configuration.send_frame_count_observer = stats_proxy;
73 configuration.send_side_delay_observer = stats_proxy; 74 configuration.send_side_delay_observer = stats_proxy;
74 configuration.send_packet_observer = send_delay_stats; 75 configuration.send_packet_observer = send_delay_stats;
75 configuration.event_log = event_log; 76 configuration.event_log = event_log;
77 configuration.retransmission_rate_limiter = retransmission_rate_limiter;
76 78
77 std::vector<RtpRtcp*> modules; 79 std::vector<RtpRtcp*> modules;
78 for (size_t i = 0; i < num_modules; ++i) { 80 for (size_t i = 0; i < num_modules; ++i) {
79 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration); 81 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration);
80 rtp_rtcp->SetSendingStatus(false); 82 rtp_rtcp->SetSendingStatus(false);
81 rtp_rtcp->SetSendingMediaStatus(false); 83 rtp_rtcp->SetSendingMediaStatus(false);
82 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); 84 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound);
83 modules.push_back(rtp_rtcp); 85 modules.push_back(rtp_rtcp);
84 } 86 }
85 return modules; 87 return modules;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 config.send_transport, 421 config.send_transport,
420 &encoder_feedback_, 422 &encoder_feedback_,
421 bandwidth_observer_.get(), 423 bandwidth_observer_.get(),
422 congestion_controller_->GetTransportFeedbackObserver(), 424 congestion_controller_->GetTransportFeedbackObserver(),
423 call_stats_->rtcp_rtt_stats(), 425 call_stats_->rtcp_rtt_stats(),
424 congestion_controller_->pacer(), 426 congestion_controller_->pacer(),
425 congestion_controller_->packet_router(), 427 congestion_controller_->packet_router(),
426 &stats_proxy_, 428 &stats_proxy_,
427 send_delay_stats, 429 send_delay_stats,
428 event_log, 430 event_log,
431 congestion_controller_->GetRetransmissionRateLimiter(),
429 config_.rtp.ssrcs.size())), 432 config_.rtp.ssrcs.size())),
430 payload_router_(rtp_rtcp_modules_, config.encoder_settings.payload_type), 433 payload_router_(rtp_rtcp_modules_, config.encoder_settings.payload_type),
431 input_(&encoder_wakeup_event_, 434 input_(&encoder_wakeup_event_,
432 config_.local_renderer, 435 config_.local_renderer,
433 &stats_proxy_, 436 &stats_proxy_,
434 &overuse_detector_) { 437 &overuse_detector_) {
435 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString(); 438 LOG(LS_INFO) << "VideoSendStream: " << config_.ToString();
436 439
437 RTC_DCHECK(!config_.rtp.ssrcs.empty()); 440 RTC_DCHECK(!config_.rtp.ssrcs.empty());
438 RTC_DCHECK(module_process_thread_); 441 RTC_DCHECK(module_process_thread_);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 void VideoSendStream::SignalNetworkState(NetworkState state) { 865 void VideoSendStream::SignalNetworkState(NetworkState state) {
863 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 866 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
864 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode 867 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode
865 : RtcpMode::kOff); 868 : RtcpMode::kOff);
866 } 869 }
867 } 870 }
868 871
869 uint32_t VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, 872 uint32_t VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
870 uint8_t fraction_loss, 873 uint8_t fraction_loss,
871 int64_t rtt) { 874 int64_t rtt) {
872 payload_router_.SetTargetSendBitrate(bitrate_bps);
873 // Get the encoder target rate. It is the estimated network rate - 875 // Get the encoder target rate. It is the estimated network rate -
874 // protection overhead. 876 // protection overhead.
875 uint32_t encoder_target_rate_bps = 877 uint32_t encoder_target_rate_bps =
876 protection_bitrate_calculator_.SetTargetRates( 878 protection_bitrate_calculator_.SetTargetRates(
877 bitrate_bps, stats_proxy_.GetSendFrameRate(), fraction_loss, rtt); 879 bitrate_bps, stats_proxy_.GetSendFrameRate(), fraction_loss, rtt);
878 vie_encoder_.OnBitrateUpdated(encoder_target_rate_bps, fraction_loss, rtt); 880 vie_encoder_.OnBitrateUpdated(encoder_target_rate_bps, fraction_loss, rtt);
879 881
880 return bitrate_bps - encoder_target_rate_bps; 882 return bitrate_bps - encoder_target_rate_bps;
881 } 883 }
882 884
(...skipping 15 matching lines...) Expand all
898 &module_nack_rate); 900 &module_nack_rate);
899 *sent_video_rate_bps += module_video_rate; 901 *sent_video_rate_bps += module_video_rate;
900 *sent_nack_rate_bps += module_nack_rate; 902 *sent_nack_rate_bps += module_nack_rate;
901 *sent_fec_rate_bps += module_fec_rate; 903 *sent_fec_rate_bps += module_fec_rate;
902 } 904 }
903 return 0; 905 return 0;
904 } 906 }
905 907
906 } // namespace internal 908 } // namespace internal
907 } // namespace webrtc 909 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698