RtpPacketHistory: StoreAndCull default on, support ack removals

Add support for potentially out-of-order removals of packets, using a
vector of sequence numbers that have been acknowledges as received.

Additionally, make kStoreAndCull storage method by default with a
field-trial kill-switch if things go wrong unexpectedly.

Bug: webrtc:8975
Change-Id: I6da8b92d85fc362c12db82976f115626cb1d32d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134307
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27850}
This commit is contained in:
Erik Språng
2019-05-03 10:58:50 -04:00
committed by Commit Bot
parent 9363c778fe
commit d2a634447f
5 changed files with 140 additions and 41 deletions

View File

@ -89,6 +89,9 @@ class RtpPacketHistory {
std::unique_ptr<RtpPacketToSend> GetBestFittingPacket(
size_t packet_size) const;
// Cull packets that have been acknowledged as received by the remote end.
void CullAcknowledgedPackets(rtc::ArrayView<const uint16_t> sequence_numbers);
private:
struct StoredPacket {
StoredPacket();
@ -133,6 +136,7 @@ class RtpPacketHistory {
// Map from rtp sequence numbers to stored packet.
std::map<uint16_t, StoredPacket> packet_history_ RTC_GUARDED_BY(lock_);
// Map from packet size to sequence number.
std::map<size_t, uint16_t> packet_size_ RTC_GUARDED_BY(lock_);
// The earliest packet in the history. This might not be the lowest sequence