Fixed potential crash if rtp packet history is completely full.

Also performance enhanecement in rtp_sender (don't lookup if kDontStore)

BUG=4171
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39759004

Cr-Commit-Position: refs/heads/master@{#8226}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8226 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org
2015-02-02 13:08:02 +00:00
parent c420a86f4c
commit c957ffc6dc
4 changed files with 45 additions and 11 deletions

View File

@ -1003,13 +1003,21 @@ int32_t RTPSender::SendToNetwork(
}
size_t length = payload_length + rtp_header_length;
if (!SendPacketToNetwork(buffer, length))
bool sent = SendPacketToNetwork(buffer, length);
if (storage != kDontStore) {
// Mark the packet as sent in the history even if send failed. Dropping a
// packet here should be treated as any other packet drop so we should be
// ready for a retransmission.
packet_history_.SetSent(rtp_header.sequenceNumber);
}
if (!sent)
return -1;
{
CriticalSectionScoped lock(send_critsect_);
media_has_been_sent_ = true;
}
packet_history_.SetSent(rtp_header.sequenceNumber);
UpdateRtpStats(buffer, length, rtp_header, false, false);
return 0;
}