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

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

Issue 2437503004: Set actual transport overhead in rtp_rtcp (Closed)
Patch Set: Created 4 years, 2 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 405 }
406 406
407 uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const { 407 uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {
408 return rtp_sender_.MaxPayloadLength(); 408 return rtp_sender_.MaxPayloadLength();
409 } 409 }
410 410
411 uint16_t ModuleRtpRtcpImpl::MaxDataPayloadLength() const { 411 uint16_t ModuleRtpRtcpImpl::MaxDataPayloadLength() const {
412 return rtp_sender_.MaxDataPayloadLength(); 412 return rtp_sender_.MaxDataPayloadLength();
413 } 413 }
414 414
415 int32_t ModuleRtpRtcpImpl::SetTransportOverhead( 415 int32_t ModuleRtpRtcpImpl::SetTransportOverhead(
the sun 2016/10/20 08:56:46 Remove the return value from this API - the result
michaelt 2016/10/20 09:38:05 Done.
416 const bool tcp, 416 int transport_overhead_per_packet_byte) {
417 const bool ipv6, 417 if (transport_overhead_per_packet_byte == packet_overhead_) {
418 const uint8_t authentication_overhead) {
419 uint16_t packet_overhead = 0;
420 if (ipv6) {
421 packet_overhead = 40;
422 } else {
423 packet_overhead = 20;
424 }
425 if (tcp) {
426 // TCP.
427 packet_overhead += 20;
428 } else {
429 // UDP.
430 packet_overhead += 8;
431 }
432 packet_overhead += authentication_overhead;
433
434 if (packet_overhead == packet_overhead_) {
435 // Ok same as before. 418 // Ok same as before.
436 return 0; 419 return 0;
437 } 420 }
438 421
439 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_; 422 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
440 size_t max_payload_length = mtu - packet_overhead; 423 size_t max_payload_length = mtu - transport_overhead_per_packet_byte;
441 packet_overhead_ = packet_overhead; 424 packet_overhead_ = transport_overhead_per_packet_byte;
442 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 425 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
443 rtp_sender_.SetMaxPayloadLength(max_payload_length); 426 rtp_sender_.SetMaxPayloadLength(max_payload_length);
444 return 0; 427 return 0;
445 } 428 }
446 429
447 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) { 430 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) {
448 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu; 431 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu;
449 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu; 432 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu;
450 size_t max_payload_length = mtu - packet_overhead_; 433 size_t max_payload_length = mtu - packet_overhead_;
451 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 434 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 916 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
934 StreamDataCountersCallback* callback) { 917 StreamDataCountersCallback* callback) {
935 rtp_sender_.RegisterRtpStatisticsCallback(callback); 918 rtp_sender_.RegisterRtpStatisticsCallback(callback);
936 } 919 }
937 920
938 StreamDataCountersCallback* 921 StreamDataCountersCallback*
939 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 922 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
940 return rtp_sender_.GetRtpStatisticsCallback(); 923 return rtp_sender_.GetRtpStatisticsCallback();
941 } 924 }
942 } // namespace webrtc 925 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698