OLD | NEW |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 // Get processed rtt. | 179 // Get processed rtt. |
180 if (process_rtt) { | 180 if (process_rtt) { |
181 last_rtt_process_time_ = now; | 181 last_rtt_process_time_ = now; |
182 if (rtt_stats_) | 182 if (rtt_stats_) |
183 set_rtt_ms(rtt_stats_->LastProcessedRtt()); | 183 set_rtt_ms(rtt_stats_->LastProcessedRtt()); |
184 } | 184 } |
185 | 185 |
186 if (rtcp_sender_.TimeToSendRTCPReport()) | 186 // For sending streams, make sure to not send a SR before media has been sent. |
187 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 187 if (rtcp_sender_.TimeToSendRTCPReport()) { |
| 188 RTCPSender::FeedbackState state = GetFeedbackState(); |
| 189 // Prevent sending streams to send SR before any media has been sent. |
| 190 if (!rtcp_sender_.Sending() || state.packets_sent > 0) |
| 191 rtcp_sender_.SendRTCP(state, kRtcpReport); |
| 192 } |
188 | 193 |
189 if (UpdateRTCPReceiveInformationTimers()) { | 194 if (UpdateRTCPReceiveInformationTimers()) { |
190 // A receiver has timed out | 195 // A receiver has timed out |
191 rtcp_receiver_.UpdateTMMBR(); | 196 rtcp_receiver_.UpdateTMMBR(); |
192 } | 197 } |
193 return 0; | 198 return 0; |
194 } | 199 } |
195 | 200 |
196 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { | 201 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { |
197 rtp_sender_.SetRtxStatus(mode); | 202 rtp_sender_.SetRtxStatus(mode); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 int32_t ModuleRtpRtcpImpl::SendOutgoingData( | 400 int32_t ModuleRtpRtcpImpl::SendOutgoingData( |
396 FrameType frame_type, | 401 FrameType frame_type, |
397 int8_t payload_type, | 402 int8_t payload_type, |
398 uint32_t time_stamp, | 403 uint32_t time_stamp, |
399 int64_t capture_time_ms, | 404 int64_t capture_time_ms, |
400 const uint8_t* payload_data, | 405 const uint8_t* payload_data, |
401 size_t payload_size, | 406 size_t payload_size, |
402 const RTPFragmentationHeader* fragmentation, | 407 const RTPFragmentationHeader* fragmentation, |
403 const RTPVideoHeader* rtp_video_hdr) { | 408 const RTPVideoHeader* rtp_video_hdr) { |
404 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 409 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
| 410 // Make sure an RTCP report isn't queued behind a key frame. |
405 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 411 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
406 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 412 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
407 } | 413 } |
408 return rtp_sender_.SendOutgoingData( | 414 return rtp_sender_.SendOutgoingData( |
409 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 415 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
410 payload_size, fragmentation, rtp_video_hdr); | 416 payload_size, fragmentation, rtp_video_hdr); |
411 } | 417 } |
412 | 418 |
413 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 419 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
414 uint16_t sequence_number, | 420 uint16_t sequence_number, |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 991 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
986 StreamDataCountersCallback* callback) { | 992 StreamDataCountersCallback* callback) { |
987 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 993 rtp_sender_.RegisterRtpStatisticsCallback(callback); |
988 } | 994 } |
989 | 995 |
990 StreamDataCountersCallback* | 996 StreamDataCountersCallback* |
991 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 997 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
992 return rtp_sender_.GetRtpStatisticsCallback(); | 998 return rtp_sender_.GetRtpStatisticsCallback(); |
993 } | 999 } |
994 } // namespace webrtc | 1000 } // namespace webrtc |
OLD | NEW |