Always verify packet wasn't resend recently before resending it.

Pacer may accept same packet serveral time for resending,
packet may spend non-zero time in pacer queue.
As a result packet can be resend several time within one rtt
wasting bandwidth.

Bug: None
Change-Id: I753a5400b47d3804735e66e539a1b103916d0c94
Reviewed-on: https://webrtc-review.googlesource.com/c/106260
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25205}
This commit is contained in:
Danil Chapovalov
2018-10-16 11:01:05 +02:00
committed by Commit Bot
parent 2d0c68744c
commit 6c78ff486a
4 changed files with 69 additions and 76 deletions

View File

@ -76,16 +76,13 @@ class RtpPacketHistory {
absl::optional<int64_t> send_time_ms);
// Gets stored RTP packet corresponding to the input |sequence number|.
// Returns nullptr if packet is not found. If |verify_rtt| is true, doesn't
// return packet that was (re)sent too recently.
// Returns nullptr if packet is not found or was (re)sent too recently.
std::unique_ptr<RtpPacketToSend> GetPacketAndSetSendTime(
uint16_t sequence_number,
bool verify_rtt);
uint16_t sequence_number);
// Similar to GetPacketAndSetSendTime(), but only returns a snapshot of the
// current state for packet, and never updates internal state.
absl::optional<PacketState> GetPacketState(uint16_t sequence_number,
bool verify_rtt) const;
absl::optional<PacketState> GetPacketState(uint16_t sequence_number) const;
// Get the packet (if any) from the history, with size closest to
// |packet_size|. The exact size of the packet is not guaranteed.