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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index a5fccebad1dd67eb792fcf70ae402fafdcac5700..440bd50d57461a91b4e9105e9ea1629cd9bd16d2 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -99,8 +99,10 @@ class PacketContainer : public rtcp::CompoundPacket,
}
}
- size_t SendPackets() {
- rtcp::CompoundPacket::Build(this);
+ size_t SendPackets(size_t max_payload_length) {
+ RTC_DCHECK_LE(max_payload_length, static_cast<size_t>(IP_PACKET_SIZE));
+ uint8_t buffer[IP_PACKET_SIZE];
+ BuildExternalBuffer(buffer, max_payload_length, this);
return bytes_sent_;
}
@@ -169,6 +171,7 @@ RTCPSender::RTCPSender(
tmmbr_help_(),
tmmbr_send_(0),
packet_oh_send_(0),
+ max_payload_length_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default.
app_sub_type_(0),
app_name_(0),
@@ -277,6 +280,10 @@ void RTCPSender::SetTMMBRStatus(bool enable) {
}
}
+void RTCPSender::SetMaxPayloadLength(size_t max_payload_length) {
+ max_payload_length_ = max_payload_length;
+}
+
void RTCPSender::SetStartTimestamp(uint32_t start_timestamp) {
rtc::CritScope lock(&critical_section_rtcp_sender_);
start_timestamp_ = start_timestamp;
@@ -809,7 +816,7 @@ int32_t RTCPSender::SendCompoundRTCP(
RTC_DCHECK(AllVolatileFlagsConsumed());
}
- size_t bytes_sent = container.SendPackets();
+ size_t bytes_sent = container.SendPackets(max_payload_length_);
return bytes_sent == 0 ? -1 : 0;
}
@@ -1030,8 +1037,9 @@ bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
// but we can't because of an incorrect warning (C4822) in MVS 2013.
} sender(transport_, event_log_);
+ RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE));
uint8_t buffer[IP_PACKET_SIZE];
- return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
+ return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) &&
!sender.send_failure_;
}
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698