Calculate relative arrival delay for reordered packets.

This changes behavior slightly but results in a better delay estimate and cleaner code.

Bug: webrtc:10178
Change-Id: If150258bc1ea58149940f17c5660733ff61159c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230740
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34883}
This commit is contained in:
Jakob Ivarsson
2021-08-30 18:13:18 +02:00
committed by WebRTC LUCI CQ
parent 9680d29e8d
commit 25edb62a94
3 changed files with 14 additions and 37 deletions

View File

@ -101,7 +101,6 @@ class DelayManager {
bool IsValidBaseMinimumDelay(int delay_ms) const;
bool first_packet_received_;
// TODO(jakobi): set maximum buffer delay instead of number of packets.
const int max_packets_in_buffer_;
std::unique_ptr<Histogram> histogram_;
@ -119,8 +118,8 @@ class DelayManager {
std::unique_ptr<TickTimer::Stopwatch>
packet_iat_stopwatch_; // Time elapsed since last packet.
int target_level_ms_; // Currently preferred buffer level.
uint32_t last_timestamp_; // Timestamp for the last received packet.
int num_reordered_packets_ = 0;
absl::optional<uint32_t>
last_timestamp_; // Timestamp for the last received packet.
int max_delay_in_interval_ms_ = 0;
std::unique_ptr<TickTimer::Stopwatch> resample_stopwatch_;