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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 2704263003: Add protection for RTCPSender::max_packet_size_. (Closed)
Patch Set: Created 3 years, 10 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') | no next file » | 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 776e5bb62069e5eaa11d9657cfaaa94818a740f1..986d51acd40702c9c25ced0786ca38b60c44c375 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -282,6 +282,7 @@ void RTCPSender::SetTMMBRStatus(bool enable) {
}
void RTCPSender::SetMaxRtpPacketSize(size_t max_packet_size) {
+ rtc::CritScope lock(&critical_section_rtcp_sender_);
max_packet_size_ = max_packet_size;
}
@@ -749,6 +750,8 @@ int32_t RTCPSender::SendCompoundRTCP(
const uint16_t* nack_list,
uint64_t pictureID) {
PacketContainer container(transport_, event_log_);
+ size_t max_packet_size;
+
{
rtc::CritScope lock(&critical_section_rtcp_sender_);
if (method_ == RtcpMode::kOff) {
@@ -821,9 +824,10 @@ int32_t RTCPSender::SendCompoundRTCP(
}
RTC_DCHECK(AllVolatileFlagsConsumed());
+ max_packet_size = max_packet_size_;
}
- size_t bytes_sent = container.SendPackets(max_packet_size_);
+ size_t bytes_sent = container.SendPackets(max_packet_size);
nisse-webrtc 2017/02/21 09:07:26 Or can we move this inside the above scope, which
danilchap 2017/02/21 09:16:31 Better not: SendPackets involves calling transport
return bytes_sent == 0 ? -1 : 0;
}
@@ -1040,15 +1044,17 @@ bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
// but we can't because of an incorrect warning (C4822) in MVS 2013.
} sender(transport_, event_log_);
+ size_t max_packet_size;
{
rtc::CritScope lock(&critical_section_rtcp_sender_);
if (method_ == RtcpMode::kOff)
return false;
+ max_packet_size = max_packet_size_;
}
- RTC_DCHECK_LE(max_packet_size_, IP_PACKET_SIZE);
+ RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE);
uint8_t buffer[IP_PACKET_SIZE];
- return packet.BuildExternalBuffer(buffer, max_packet_size_, &sender) &&
+ return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) &&
nisse-webrtc 2017/02/21 09:07:26 Same here, can we move this inside the above, prot
danilchap 2017/02/21 09:16:31 same here: calling BuildExternalBuffer would call
!sender.send_failure_;
}
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698