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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 1826093004: Avoid rescheduling the next RTCP packet if the RTCP sender status doesn't change. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rewrote the condition to make it easier to read Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 builders_[kRtcpXrDlrrReportBlock] = &RTCPSender::BuildDlrr; 198 builders_[kRtcpXrDlrrReportBlock] = &RTCPSender::BuildDlrr;
199 } 199 }
200 200
201 RTCPSender::~RTCPSender() {} 201 RTCPSender::~RTCPSender() {}
202 202
203 RtcpMode RTCPSender::Status() const { 203 RtcpMode RTCPSender::Status() const {
204 rtc::CritScope lock(&critical_section_rtcp_sender_); 204 rtc::CritScope lock(&critical_section_rtcp_sender_);
205 return method_; 205 return method_;
206 } 206 }
207 207
208 void RTCPSender::SetRTCPStatus(RtcpMode method) { 208 void RTCPSender::SetRTCPStatus(RtcpMode new_method) {
209 rtc::CritScope lock(&critical_section_rtcp_sender_); 209 rtc::CritScope lock(&critical_section_rtcp_sender_);
210 method_ = method;
211 210
212 if (method == RtcpMode::kOff) 211 if (method_ == RtcpMode::kOff && new_method != RtcpMode::kOff) {
213 return; 212 // When switching on, reschedule the next packet
214 next_time_to_send_rtcp_ = 213 next_time_to_send_rtcp_ =
215 clock_->TimeInMilliseconds() + 214 clock_->TimeInMilliseconds() +
216 (audio_ ? RTCP_INTERVAL_AUDIO_MS / 2 : RTCP_INTERVAL_VIDEO_MS / 2); 215 (audio_ ? RTCP_INTERVAL_AUDIO_MS / 2 : RTCP_INTERVAL_VIDEO_MS / 2);
216 }
217 method_ = new_method;
217 } 218 }
218 219
219 bool RTCPSender::Sending() const { 220 bool RTCPSender::Sending() const {
220 rtc::CritScope lock(&critical_section_rtcp_sender_); 221 rtc::CritScope lock(&critical_section_rtcp_sender_);
221 return sending_; 222 return sending_;
222 } 223 }
223 224
224 int32_t RTCPSender::SetSendingStatus(const FeedbackState& feedback_state, 225 int32_t RTCPSender::SetSendingStatus(const FeedbackState& feedback_state,
225 bool sending) { 226 bool sending) {
226 bool sendRTCPBye = false; 227 bool sendRTCPBye = false;
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); 1030 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender);
1030 // but we can't because of an incorrect warning (C4822) in MVS 2013. 1031 // but we can't because of an incorrect warning (C4822) in MVS 2013.
1031 } sender(transport_, event_log_); 1032 } sender(transport_, event_log_);
1032 1033
1033 uint8_t buffer[IP_PACKET_SIZE]; 1034 uint8_t buffer[IP_PACKET_SIZE];
1034 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && 1035 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
1035 !sender.send_failure_; 1036 !sender.send_failure_;
1036 } 1037 }
1037 1038
1038 } // namespace webrtc 1039 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698