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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc

Issue 1827953002: Make rtcp sender use max transfer unit. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 nack_last_seq_number_sent_(0), 111 nack_last_seq_number_sent_(0),
112 key_frame_req_method_(kKeyFrameReqPliRtcp), 112 key_frame_req_method_(kKeyFrameReqPliRtcp),
113 remote_bitrate_(configuration.remote_bitrate_estimator), 113 remote_bitrate_(configuration.remote_bitrate_estimator),
114 rtt_stats_(configuration.rtt_stats), 114 rtt_stats_(configuration.rtt_stats),
115 critical_section_rtt_(CriticalSectionWrapper::CreateCriticalSection()), 115 critical_section_rtt_(CriticalSectionWrapper::CreateCriticalSection()),
116 rtt_ms_(0) { 116 rtt_ms_(0) {
117 // Make sure that RTCP objects are aware of our SSRC. 117 // Make sure that RTCP objects are aware of our SSRC.
118 uint32_t SSRC = rtp_sender_.SSRC(); 118 uint32_t SSRC = rtp_sender_.SSRC();
119 rtcp_sender_.SetSSRC(SSRC); 119 rtcp_sender_.SetSSRC(SSRC);
120 SetRtcpReceiverSsrcs(SSRC); 120 SetRtcpReceiverSsrcs(SSRC);
121 SetMaxTransferUnit(IP_PACKET_SIZE);
121 } 122 }
122 123
123 // Returns the number of milliseconds until the module want a worker thread 124 // Returns the number of milliseconds until the module want a worker thread
124 // to call Process. 125 // to call Process.
125 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { 126 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() {
126 const int64_t now = clock_->TimeInMilliseconds(); 127 const int64_t now = clock_->TimeInMilliseconds();
127 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; 128 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5;
128 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); 129 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_);
129 } 130 }
130 131
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } else { 473 } else {
473 // UDP. 474 // UDP.
474 packet_overhead += 8; 475 packet_overhead += 8;
475 } 476 }
476 packet_overhead += authentication_overhead; 477 packet_overhead += authentication_overhead;
477 478
478 if (packet_overhead == packet_overhead_) { 479 if (packet_overhead == packet_overhead_) {
479 // Ok same as before. 480 // Ok same as before.
480 return 0; 481 return 0;
481 } 482 }
482 // Calc diff.
483 int16_t packet_over_head_diff = packet_overhead - packet_overhead_;
484 483
485 // Store new. 484 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
485 size_t max_payload_length = mtu - packet_overhead;
486 packet_overhead_ = packet_overhead; 486 packet_overhead_ = packet_overhead;
487 487 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
488 uint16_t length = 488 rtp_sender_.SetMaxPayloadLength(max_payload_length);
489 rtp_sender_.MaxPayloadLength() - packet_over_head_diff; 489 return 0;
490 return rtp_sender_.SetMaxPayloadLength(length, packet_overhead_);
491 } 490 }
492 491
493 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(const uint16_t mtu) { 492 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) {
494 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "Invalid mtu: " << mtu; 493 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu;
495 return rtp_sender_.SetMaxPayloadLength(mtu - packet_overhead_, 494 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu;
496 packet_overhead_); 495 size_t max_payload_length = mtu - packet_overhead_;
496 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
497 rtp_sender_.SetMaxPayloadLength(max_payload_length);
498 return 0;
497 } 499 }
498 500
499 RtcpMode ModuleRtpRtcpImpl::RTCP() const { 501 RtcpMode ModuleRtpRtcpImpl::RTCP() const {
500 return rtcp_sender_.Status(); 502 return rtcp_sender_.Status();
501 } 503 }
502 504
503 // Configure RTCP status i.e on/off. 505 // Configure RTCP status i.e on/off.
504 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { 506 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) {
505 rtcp_sender_.SetRTCPStatus(method); 507 rtcp_sender_.SetRTCPStatus(method);
506 } 508 }
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 994 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
993 StreamDataCountersCallback* callback) { 995 StreamDataCountersCallback* callback) {
994 rtp_sender_.RegisterRtpStatisticsCallback(callback); 996 rtp_sender_.RegisterRtpStatisticsCallback(callback);
995 } 997 }
996 998
997 StreamDataCountersCallback* 999 StreamDataCountersCallback*
998 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 1000 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
999 return rtp_sender_.GetRtpStatisticsCallback(); 1001 return rtp_sender_.GetRtpStatisticsCallback();
1000 } 1002 }
1001 } // namespace webrtc 1003 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698