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

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: Rename SignalTransportOverheadChanged to UpdateTransportOverhead. Created 4 years, 1 month 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 446
447 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_; 447 size_t mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
448 size_t max_payload_length = mtu - packet_overhead; 448 size_t max_payload_length = mtu - packet_overhead;
449 packet_overhead_ = packet_overhead; 449 packet_overhead_ = packet_overhead;
450 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 450 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
451 rtp_sender_.SetMaxPayloadLength(max_payload_length); 451 rtp_sender_.SetMaxPayloadLength(max_payload_length);
452 return 0; 452 return 0;
453 } 453 }
454 454
455 void ModuleRtpRtcpImpl::SetTransportOverhead(
456 int transport_overhead_per_packet) {
457 RTC_DCHECK_GT(transport_overhead_per_packet, 0);
458 int mtu = rtp_sender_.MaxPayloadLength() + packet_overhead_;
459 RTC_DCHECK_LT(transport_overhead_per_packet, mtu);
460 size_t max_payload_length = mtu - transport_overhead_per_packet;
461 packet_overhead_ = transport_overhead_per_packet;
462 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
463 rtp_sender_.SetMaxPayloadLength(max_payload_length);
464 }
465
455 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) { 466 int32_t ModuleRtpRtcpImpl::SetMaxTransferUnit(uint16_t mtu) {
456 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu; 467 RTC_DCHECK_LE(mtu, IP_PACKET_SIZE) << "MTU too large: " << mtu;
457 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu; 468 RTC_DCHECK_GT(mtu, packet_overhead_) << "MTU too small: " << mtu;
458 size_t max_payload_length = mtu - packet_overhead_; 469 size_t max_payload_length = mtu - packet_overhead_;
459 rtcp_sender_.SetMaxPayloadLength(max_payload_length); 470 rtcp_sender_.SetMaxPayloadLength(max_payload_length);
460 rtp_sender_.SetMaxPayloadLength(max_payload_length); 471 rtp_sender_.SetMaxPayloadLength(max_payload_length);
461 return 0; 472 return 0;
462 } 473 }
463 474
464 RtcpMode ModuleRtpRtcpImpl::RTCP() const { 475 RtcpMode ModuleRtpRtcpImpl::RTCP() const {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 944 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
934 StreamDataCountersCallback* callback) { 945 StreamDataCountersCallback* callback) {
935 rtp_sender_.RegisterRtpStatisticsCallback(callback); 946 rtp_sender_.RegisterRtpStatisticsCallback(callback);
936 } 947 }
937 948
938 StreamDataCountersCallback* 949 StreamDataCountersCallback*
939 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 950 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
940 return rtp_sender_.GetRtpStatisticsCallback(); 951 return rtp_sender_.GetRtpStatisticsCallback();
941 } 952 }
942 } // namespace webrtc 953 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h ('k') | webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698