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

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: responde to comments 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_; 439 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
440 size_t max_payload_length = mtu - packet_overhead; 440 size_t max_payload_length = mtu - packet_overhead;
441 packet_overhead_ = packet_overhead; 441 packet_overhead_ = packet_overhead;
442 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 442 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
443 rtp_sender_.SetMaxPayloadLength(max_payload_length); 443 rtp_sender_.SetMaxPayloadLength(max_payload_length);
444 return 0; 444 return 0;
445 } 445 }
446 446
447 void ModuleRtpRtcpImpl::SetTransportOverhead(
448 int transport_overhead_per_packet_byte) {
449 if (transport_overhead_per_packet_byte == packet_overhead_) {
the sun 2016/10/24 08:35:35 Is there a valid range for the input, which you ca
the sun 2016/10/24 08:35:35 Is this optimization really necessary?
michaelt 2016/10/24 09:15:26 Yes added DCHECKS
michaelt 2016/10/24 09:15:26 We can remove it. SetTransportOverhead should not
450 // Ok same as before.
451 return;
452 }
453
454 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
455 size_t max_payload_length = mtu - transport_overhead_per_packet_byte;
456 packet_overhead_ = transport_overhead_per_packet_byte;
457 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
458 rtp_sender_.SetMaxPayloadLength(max_payload_length);
459 }
460
447 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) { 461 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) {
448 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu; 462 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu;
449 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu; 463 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu;
450 size_t max_payload_length = mtu - packet_overhead_; 464 size_t max_payload_length = mtu - packet_overhead_;
451 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 465 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
452 rtp_sender_.SetMaxPayloadLength(max_payload_length); 466 rtp_sender_.SetMaxPayloadLength(max_payload_length);
453 return 0; 467 return 0;
454 } 468 }
455 469
456 RtcpMode ModuleRtpRtcpImpl::RTCP() const { 470 RtcpMode ModuleRtpRtcpImpl::RTCP() const {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 947 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
934 StreamDataCountersCallback* callback) { 948 StreamDataCountersCallback* callback) {
935 rtp_sender_.RegisterRtpStatisticsCallback(callback); 949 rtp_sender_.RegisterRtpStatisticsCallback(callback);
936 } 950 }
937 951
938 StreamDataCountersCallback* 952 StreamDataCountersCallback*
939 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 953 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
940 return rtp_sender_.GetRtpStatisticsCallback(); 954 return rtp_sender_.GetRtpStatisticsCallback();
941 } 955 }
942 } // namespace webrtc 956 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698