Prevent RTCP SR to be sent with bogus timestamp.

This CL makes sure no RTCP SR is sent before there is a valid timestamp
to set in the SR, based on the first sent media packet.

BUG=webrtc:1600
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1506103006 .

Cr-Commit-Position: refs/heads/master@{#10964}
This commit is contained in:
mflodman
2015-12-10 10:10:44 +01:00
parent 48bf2382d9
commit 0b3d7eec07
2 changed files with 29 additions and 3 deletions

View File

@ -183,8 +183,13 @@ int32_t ModuleRtpRtcpImpl::Process() {
set_rtt_ms(rtt_stats_->LastProcessedRtt());
}
if (rtcp_sender_.TimeToSendRTCPReport())
rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
// For sending streams, make sure to not send a SR before media has been sent.
if (rtcp_sender_.TimeToSendRTCPReport()) {
RTCPSender::FeedbackState state = GetFeedbackState();
// Prevent sending streams to send SR before any media has been sent.
if (!rtcp_sender_.Sending() || state.packets_sent > 0)
rtcp_sender_.SendRTCP(state, kRtcpReport);
}
if (UpdateRTCPReceiveInformationTimers()) {
// A receiver has timed out
@ -402,6 +407,7 @@ int32_t ModuleRtpRtcpImpl::SendOutgoingData(
const RTPFragmentationHeader* fragmentation,
const RTPVideoHeader* rtp_video_hdr) {
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
// Make sure an RTCP report isn't queued behind a key frame.
if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
}