Chromium Code Reviews| 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_; |
| } |