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 12 matching lines...) Expand all Loading... | |
23 #include "webrtc/base/weak_ptr.h" | 23 #include "webrtc/base/weak_ptr.h" |
24 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 24 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
25 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 25 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
26 #include "webrtc/modules/pacing/packet_router.h" | 26 #include "webrtc/modules/pacing/packet_router.h" |
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
28 #include "webrtc/modules/utility/include/process_thread.h" | 28 #include "webrtc/modules/utility/include/process_thread.h" |
29 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 29 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
30 #include "webrtc/video/call_stats.h" | 30 #include "webrtc/video/call_stats.h" |
31 #include "webrtc/video/vie_remb.h" | 31 #include "webrtc/video/vie_remb.h" |
32 #include "webrtc/video_send_stream.h" | 32 #include "webrtc/video_send_stream.h" |
33 #include "webrtc/system_wrappers/include/field_trial.h" | |
stefan-webrtc
2016/11/28 15:14:14
Sort
michaelt
2016/11/28 15:50:45
Done.
| |
33 | 34 |
34 namespace webrtc { | 35 namespace webrtc { |
35 | 36 |
36 static const int kMinSendSidePacketHistorySize = 600; | 37 static const int kMinSendSidePacketHistorySize = 600; |
37 namespace { | 38 namespace { |
38 | 39 |
39 std::vector<RtpRtcp*> CreateRtpRtcpModules( | 40 std::vector<RtpRtcp*> CreateRtpRtcpModules( |
40 Transport* outgoing_transport, | 41 Transport* outgoing_transport, |
41 RtcpIntraFrameObserver* intra_frame_callback, | 42 RtcpIntraFrameObserver* intra_frame_callback, |
42 RtcpBandwidthObserver* bandwidth_callback, | 43 RtcpBandwidthObserver* bandwidth_callback, |
43 TransportFeedbackObserver* transport_feedback_callback, | 44 TransportFeedbackObserver* transport_feedback_callback, |
44 RtcpRttStats* rtt_stats, | 45 RtcpRttStats* rtt_stats, |
45 RtpPacketSender* paced_sender, | 46 RtpPacketSender* paced_sender, |
46 TransportSequenceNumberAllocator* transport_sequence_number_allocator, | 47 TransportSequenceNumberAllocator* transport_sequence_number_allocator, |
47 FlexfecSender* flexfec_sender, | 48 FlexfecSender* flexfec_sender, |
48 SendStatisticsProxy* stats_proxy, | 49 SendStatisticsProxy* stats_proxy, |
49 SendDelayStats* send_delay_stats, | 50 SendDelayStats* send_delay_stats, |
50 RtcEventLog* event_log, | 51 RtcEventLog* event_log, |
51 RateLimiter* retransmission_rate_limiter, | 52 RateLimiter* retransmission_rate_limiter, |
53 OverheadObserver* overhead_observer, | |
52 size_t num_modules) { | 54 size_t num_modules) { |
53 RTC_DCHECK_GT(num_modules, 0u); | 55 RTC_DCHECK_GT(num_modules, 0u); |
54 RtpRtcp::Configuration configuration; | 56 RtpRtcp::Configuration configuration; |
55 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics; | 57 ReceiveStatistics* null_receive_statistics = configuration.receive_statistics; |
56 configuration.audio = false; | 58 configuration.audio = false; |
57 configuration.receiver_only = false; | 59 configuration.receiver_only = false; |
58 configuration.flexfec_sender = flexfec_sender; | 60 configuration.flexfec_sender = flexfec_sender; |
59 configuration.receive_statistics = null_receive_statistics; | 61 configuration.receive_statistics = null_receive_statistics; |
60 configuration.outgoing_transport = outgoing_transport; | 62 configuration.outgoing_transport = outgoing_transport; |
61 configuration.intra_frame_callback = intra_frame_callback; | 63 configuration.intra_frame_callback = intra_frame_callback; |
62 configuration.bandwidth_callback = bandwidth_callback; | 64 configuration.bandwidth_callback = bandwidth_callback; |
63 configuration.transport_feedback_callback = transport_feedback_callback; | 65 configuration.transport_feedback_callback = transport_feedback_callback; |
64 configuration.rtt_stats = rtt_stats; | 66 configuration.rtt_stats = rtt_stats; |
65 configuration.rtcp_packet_type_counter_observer = stats_proxy; | 67 configuration.rtcp_packet_type_counter_observer = stats_proxy; |
66 configuration.paced_sender = paced_sender; | 68 configuration.paced_sender = paced_sender; |
67 configuration.transport_sequence_number_allocator = | 69 configuration.transport_sequence_number_allocator = |
68 transport_sequence_number_allocator; | 70 transport_sequence_number_allocator; |
69 configuration.send_bitrate_observer = stats_proxy; | 71 configuration.send_bitrate_observer = stats_proxy; |
70 configuration.send_frame_count_observer = stats_proxy; | 72 configuration.send_frame_count_observer = stats_proxy; |
71 configuration.send_side_delay_observer = stats_proxy; | 73 configuration.send_side_delay_observer = stats_proxy; |
72 configuration.send_packet_observer = send_delay_stats; | 74 configuration.send_packet_observer = send_delay_stats; |
73 configuration.event_log = event_log; | 75 configuration.event_log = event_log; |
74 configuration.retransmission_rate_limiter = retransmission_rate_limiter; | 76 configuration.retransmission_rate_limiter = retransmission_rate_limiter; |
75 | 77 configuration.overhead_observer = overhead_observer; |
76 std::vector<RtpRtcp*> modules; | 78 std::vector<RtpRtcp*> modules; |
77 for (size_t i = 0; i < num_modules; ++i) { | 79 for (size_t i = 0; i < num_modules; ++i) { |
78 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration); | 80 RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(configuration); |
79 rtp_rtcp->SetSendingStatus(false); | 81 rtp_rtcp->SetSendingStatus(false); |
80 rtp_rtcp->SetSendingMediaStatus(false); | 82 rtp_rtcp->SetSendingMediaStatus(false); |
81 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); | 83 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); |
82 modules.push_back(rtp_rtcp); | 84 modules.push_back(rtp_rtcp); |
83 } | 85 } |
84 return modules; | 86 return modules; |
85 } | 87 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 namespace internal { | 279 namespace internal { |
278 | 280 |
279 // VideoSendStreamImpl implements internal::VideoSendStream. | 281 // VideoSendStreamImpl implements internal::VideoSendStream. |
280 // It is created and destroyed on |worker_queue|. The intent is to decrease the | 282 // It is created and destroyed on |worker_queue|. The intent is to decrease the |
281 // need for locking and to ensure methods are called in sequence. | 283 // need for locking and to ensure methods are called in sequence. |
282 // Public methods except |DeliverRtcp| must be called on |worker_queue|. | 284 // Public methods except |DeliverRtcp| must be called on |worker_queue|. |
283 // DeliverRtcp is called on the libjingle worker thread or a network thread. | 285 // DeliverRtcp is called on the libjingle worker thread or a network thread. |
284 // An encoder may deliver frames through the EncodedImageCallback on an | 286 // An encoder may deliver frames through the EncodedImageCallback on an |
285 // arbitrary thread. | 287 // arbitrary thread. |
286 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, | 288 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, |
289 public webrtc::OverheadObserver, | |
287 public webrtc::VCMProtectionCallback, | 290 public webrtc::VCMProtectionCallback, |
288 public ViEEncoder::EncoderSink { | 291 public ViEEncoder::EncoderSink { |
289 public: | 292 public: |
290 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, | 293 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
291 rtc::TaskQueue* worker_queue, | 294 rtc::TaskQueue* worker_queue, |
292 CallStats* call_stats, | 295 CallStats* call_stats, |
293 CongestionController* congestion_controller, | 296 CongestionController* congestion_controller, |
294 BitrateAllocator* bitrate_allocator, | 297 BitrateAllocator* bitrate_allocator, |
295 SendDelayStats* send_delay_stats, | 298 SendDelayStats* send_delay_stats, |
296 VieRemb* remb, | 299 VieRemb* remb, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 uint8_t fraction_loss, | 333 uint8_t fraction_loss, |
331 int64_t rtt) override; | 334 int64_t rtt) override; |
332 | 335 |
333 // Implements webrtc::VCMProtectionCallback. | 336 // Implements webrtc::VCMProtectionCallback. |
334 int ProtectionRequest(const FecProtectionParams* delta_params, | 337 int ProtectionRequest(const FecProtectionParams* delta_params, |
335 const FecProtectionParams* key_params, | 338 const FecProtectionParams* key_params, |
336 uint32_t* sent_video_rate_bps, | 339 uint32_t* sent_video_rate_bps, |
337 uint32_t* sent_nack_rate_bps, | 340 uint32_t* sent_nack_rate_bps, |
338 uint32_t* sent_fec_rate_bps) override; | 341 uint32_t* sent_fec_rate_bps) override; |
339 | 342 |
343 // Implements OverheadObserver. | |
344 void OnOverheadChanged(size_t overhead_bytes_per_packet) override; | |
345 | |
340 void OnEncoderConfigurationChanged(std::vector<VideoStream> streams, | 346 void OnEncoderConfigurationChanged(std::vector<VideoStream> streams, |
341 int min_transmit_bitrate_bps) override; | 347 int min_transmit_bitrate_bps) override; |
342 | 348 |
343 // Implements EncodedImageCallback. The implementation routes encoded frames | 349 // Implements EncodedImageCallback. The implementation routes encoded frames |
344 // to the |payload_router_| and |config.pre_encode_callback| if set. | 350 // to the |payload_router_| and |config.pre_encode_callback| if set. |
345 // Called on an arbitrary encoder callback thread. | 351 // Called on an arbitrary encoder callback thread. |
346 EncodedImageCallback::Result OnEncodedImage( | 352 EncodedImageCallback::Result OnEncodedImage( |
347 const EncodedImage& encoded_image, | 353 const EncodedImage& encoded_image, |
348 const CodecSpecificInfo* codec_specific_info, | 354 const CodecSpecificInfo* codec_specific_info, |
349 const RTPFragmentationHeader* fragmentation) override; | 355 const RTPFragmentationHeader* fragmentation) override; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 const std::vector<RtpRtcp*> rtp_rtcp_modules_; | 397 const std::vector<RtpRtcp*> rtp_rtcp_modules_; |
392 PayloadRouter payload_router_; | 398 PayloadRouter payload_router_; |
393 | 399 |
394 // |weak_ptr_| to our self. This is used since we can not call | 400 // |weak_ptr_| to our self. This is used since we can not call |
395 // |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy | 401 // |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy |
396 // an existing WeakPtr. | 402 // an existing WeakPtr. |
397 rtc::WeakPtr<VideoSendStreamImpl> weak_ptr_; | 403 rtc::WeakPtr<VideoSendStreamImpl> weak_ptr_; |
398 // |weak_ptr_factory_| must be declared last to make sure all WeakPtr's are | 404 // |weak_ptr_factory_| must be declared last to make sure all WeakPtr's are |
399 // invalidated before any other members are destroyed. | 405 // invalidated before any other members are destroyed. |
400 rtc::WeakPtrFactory<VideoSendStreamImpl> weak_ptr_factory_; | 406 rtc::WeakPtrFactory<VideoSendStreamImpl> weak_ptr_factory_; |
407 | |
408 rtc::CriticalSection overhead_bytes_per_packet_crit_; | |
409 size_t overhead_bytes_per_packet_ GUARDED_BY(overhead_bytes_per_packet_crit_); | |
410 size_t transport_overhead_bytes_per_packet_; | |
401 }; | 411 }; |
402 | 412 |
403 // TODO(tommi): See if there's a more elegant way to create a task that creates | 413 // TODO(tommi): See if there's a more elegant way to create a task that creates |
404 // an object on the correct task queue. | 414 // an object on the correct task queue. |
405 class VideoSendStream::ConstructionTask : public rtc::QueuedTask { | 415 class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
406 public: | 416 public: |
407 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, | 417 ConstructionTask(std::unique_ptr<VideoSendStreamImpl>* send_stream, |
408 rtc::Event* done_event, | 418 rtc::Event* done_event, |
409 SendStatisticsProxy* stats_proxy, | 419 SendStatisticsProxy* stats_proxy, |
410 ViEEncoder* vie_encoder, | 420 ViEEncoder* vie_encoder, |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 bandwidth_observer_.get(), | 737 bandwidth_observer_.get(), |
728 congestion_controller_->GetTransportFeedbackObserver(), | 738 congestion_controller_->GetTransportFeedbackObserver(), |
729 call_stats_->rtcp_rtt_stats(), | 739 call_stats_->rtcp_rtt_stats(), |
730 congestion_controller_->pacer(), | 740 congestion_controller_->pacer(), |
731 congestion_controller_->packet_router(), | 741 congestion_controller_->packet_router(), |
732 flexfec_sender_.get(), | 742 flexfec_sender_.get(), |
733 stats_proxy_, | 743 stats_proxy_, |
734 send_delay_stats, | 744 send_delay_stats, |
735 event_log, | 745 event_log, |
736 congestion_controller_->GetRetransmissionRateLimiter(), | 746 congestion_controller_->GetRetransmissionRateLimiter(), |
747 this, | |
737 config_->rtp.ssrcs.size())), | 748 config_->rtp.ssrcs.size())), |
738 payload_router_(rtp_rtcp_modules_, | 749 payload_router_(rtp_rtcp_modules_, |
739 config_->encoder_settings.payload_type), | 750 config_->encoder_settings.payload_type), |
740 weak_ptr_factory_(this) { | 751 weak_ptr_factory_(this), |
752 overhead_bytes_per_packet_(0) { | |
741 RTC_DCHECK_RUN_ON(worker_queue_); | 753 RTC_DCHECK_RUN_ON(worker_queue_); |
742 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); | 754 LOG(LS_INFO) << "VideoSendStreamInternal: " << config_->ToString(); |
743 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); | 755 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); |
744 module_process_thread_checker_.DetachFromThread(); | 756 module_process_thread_checker_.DetachFromThread(); |
745 | 757 |
746 RTC_DCHECK(!config_->rtp.ssrcs.empty()); | 758 RTC_DCHECK(!config_->rtp.ssrcs.empty()); |
747 RTC_DCHECK(call_stats_); | 759 RTC_DCHECK(call_stats_); |
748 RTC_DCHECK(congestion_controller_); | 760 RTC_DCHECK(congestion_controller_); |
749 RTC_DCHECK(remb_); | 761 RTC_DCHECK(remb_); |
750 | 762 |
(...skipping 16 matching lines...) Expand all Loading... | |
767 } | 779 } |
768 | 780 |
769 remb_->AddRembSender(rtp_rtcp_modules_[0]); | 781 remb_->AddRembSender(rtp_rtcp_modules_[0]); |
770 rtp_rtcp_modules_[0]->SetREMBStatus(true); | 782 rtp_rtcp_modules_[0]->SetREMBStatus(true); |
771 | 783 |
772 ConfigureProtection(); | 784 ConfigureProtection(); |
773 ConfigureSsrcs(); | 785 ConfigureSsrcs(); |
774 | 786 |
775 // TODO(pbos): Should we set CNAME on all RTP modules? | 787 // TODO(pbos): Should we set CNAME on all RTP modules? |
776 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); | 788 rtp_rtcp_modules_.front()->SetCNAME(config_->rtp.c_name.c_str()); |
777 // 28 to match packet overhead in ModuleRtpRtcpImpl. | 789 |
778 static const size_t kRtpPacketSizeOverhead = 28; | |
779 RTC_DCHECK_LE(config_->rtp.max_packet_size, 0xFFFFu + kRtpPacketSizeOverhead); | |
780 const uint16_t mtu = static_cast<uint16_t>(config_->rtp.max_packet_size + | |
781 kRtpPacketSizeOverhead); | |
782 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 790 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
783 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); | 791 rtp_rtcp->RegisterRtcpStatisticsCallback(stats_proxy_); |
784 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_); | 792 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_); |
785 rtp_rtcp->SetMaxTransferUnit(mtu); | 793 rtp_rtcp->SetMaxTransferUnit(config_->rtp.max_packet_size); |
786 rtp_rtcp->RegisterVideoSendPayload( | 794 rtp_rtcp->RegisterVideoSendPayload( |
787 config_->encoder_settings.payload_type, | 795 config_->encoder_settings.payload_type, |
788 config_->encoder_settings.payload_name.c_str()); | 796 config_->encoder_settings.payload_name.c_str()); |
789 } | 797 } |
790 | 798 |
791 RTC_DCHECK(config_->encoder_settings.encoder); | 799 RTC_DCHECK(config_->encoder_settings.encoder); |
792 RTC_DCHECK_GE(config_->encoder_settings.payload_type, 0); | 800 RTC_DCHECK_GE(config_->encoder_settings.payload_type, 0); |
793 RTC_DCHECK_LE(config_->encoder_settings.payload_type, 127); | 801 RTC_DCHECK_LE(config_->encoder_settings.payload_type, 127); |
794 | 802 |
795 vie_encoder_->SetStartBitrate(bitrate_allocator_->GetStartBitrate(this)); | 803 vie_encoder_->SetStartBitrate(bitrate_allocator_->GetStartBitrate(this)); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1145 : RtcpMode::kOff); | 1153 : RtcpMode::kOff); |
1146 } | 1154 } |
1147 } | 1155 } |
1148 | 1156 |
1149 uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps, | 1157 uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps, |
1150 uint8_t fraction_loss, | 1158 uint8_t fraction_loss, |
1151 int64_t rtt) { | 1159 int64_t rtt) { |
1152 RTC_DCHECK_RUN_ON(worker_queue_); | 1160 RTC_DCHECK_RUN_ON(worker_queue_); |
1153 RTC_DCHECK(payload_router_.active()) | 1161 RTC_DCHECK(payload_router_.active()) |
1154 << "VideoSendStream::Start has not been called."; | 1162 << "VideoSendStream::Start has not been called."; |
1163 | |
1164 if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe-WithOverhead") == | |
1165 "Enabled") { | |
1166 // Substract overhead from bitrate. | |
1167 rtc::CritScope lock(&overhead_bytes_per_packet_crit_); | |
1168 int packets_per_second = | |
1169 std::ceil(bitrate_bps / (8 * (config_->rtp.max_packet_size + | |
1170 transport_overhead_bytes_per_packet_))); | |
1171 uint32_t overhead_bps = 8 * overhead_bytes_per_packet_ * packets_per_second; | |
1172 bitrate_bps = overhead_bps > bitrate_bps ? 0u : bitrate_bps - overhead_bps; | |
1173 } | |
1174 | |
1155 // Get the encoder target rate. It is the estimated network rate - | 1175 // Get the encoder target rate. It is the estimated network rate - |
1156 // protection overhead. | 1176 // protection overhead. |
1157 encoder_target_rate_bps_ = protection_bitrate_calculator_.SetTargetRates( | 1177 encoder_target_rate_bps_ = protection_bitrate_calculator_.SetTargetRates( |
1158 bitrate_bps, stats_proxy_->GetSendFrameRate(), fraction_loss, rtt); | 1178 bitrate_bps, stats_proxy_->GetSendFrameRate(), fraction_loss, rtt); |
1159 uint32_t protection_bitrate = bitrate_bps - encoder_target_rate_bps_; | 1179 uint32_t protection_bitrate = bitrate_bps - encoder_target_rate_bps_; |
1160 | 1180 |
1161 encoder_target_rate_bps_ = | 1181 encoder_target_rate_bps_ = |
1162 std::min(encoder_max_bitrate_bps_, encoder_target_rate_bps_); | 1182 std::min(encoder_max_bitrate_bps_, encoder_target_rate_bps_); |
1163 vie_encoder_->OnBitrateUpdated(encoder_target_rate_bps_, fraction_loss, rtt); | 1183 vie_encoder_->OnBitrateUpdated(encoder_target_rate_bps_, fraction_loss, rtt); |
1164 stats_proxy_->OnSetEncoderTargetRate(encoder_target_rate_bps_); | 1184 stats_proxy_->OnSetEncoderTargetRate(encoder_target_rate_bps_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 rtp_rtcp->SetFecParameters(*delta_params, *key_params); | 1224 rtp_rtcp->SetFecParameters(*delta_params, *key_params); |
1205 rtp_rtcp->BitrateSent(¬_used, &module_video_rate, &module_fec_rate, | 1225 rtp_rtcp->BitrateSent(¬_used, &module_video_rate, &module_fec_rate, |
1206 &module_nack_rate); | 1226 &module_nack_rate); |
1207 *sent_video_rate_bps += module_video_rate; | 1227 *sent_video_rate_bps += module_video_rate; |
1208 *sent_nack_rate_bps += module_nack_rate; | 1228 *sent_nack_rate_bps += module_nack_rate; |
1209 *sent_fec_rate_bps += module_fec_rate; | 1229 *sent_fec_rate_bps += module_fec_rate; |
1210 } | 1230 } |
1211 return 0; | 1231 return 0; |
1212 } | 1232 } |
1213 | 1233 |
1234 void VideoSendStreamImpl::OnOverheadChanged(size_t overhead_bytes_per_packet) { | |
1235 rtc::CritScope lock(&overhead_bytes_per_packet_crit_); | |
1236 overhead_bytes_per_packet_ = overhead_bytes_per_packet; | |
1237 } | |
1238 | |
1214 void VideoSendStreamImpl::SetTransportOverhead( | 1239 void VideoSendStreamImpl::SetTransportOverhead( |
1215 int transport_overhead_per_packet) { | 1240 int transport_overhead_bytes_per_packet) { |
1216 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 1241 transport_overhead_bytes_per_packet_ = transport_overhead_bytes_per_packet; |
1217 rtp_rtcp->SetTransportOverhead(transport_overhead_per_packet); | 1242 RTC_DCHECK_LE(config_->rtp.max_packet_size, |
1243 0xFFFFu + transport_overhead_bytes_per_packet); | |
1244 const uint16_t mtu = static_cast<uint16_t>( | |
1245 config_->rtp.max_packet_size + transport_overhead_bytes_per_packet); | |
1246 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | |
1247 rtp_rtcp->SetTransportOverhead(transport_overhead_bytes_per_packet); | |
1248 rtp_rtcp->SetMaxTransferUnit(mtu); | |
1249 } | |
1218 } | 1250 } |
1219 | 1251 |
1220 } // namespace internal | 1252 } // namespace internal |
1221 } // namespace webrtc | 1253 } // namespace webrtc |
OLD | NEW |