Adds maximum burst length to InterArrival class.
This restricts the maximum burst length to receive times 100 ms apart. Currently packets will be considered part of the same burst as long as they are received within 5 ms from the previous packet. This can happen when recovering from large network buffers. Bug: webrtc:9718 Change-Id: I73027ddaae922cb7bb9a477cf29b4f0036ce6966 Reviewed-on: https://webrtc-review.googlesource.com/98280 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24601}
This commit is contained in:
parent
5c3cf05788
commit
be20ef789d
@ -19,6 +19,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
static const int kBurstDeltaThresholdMs = 5;
|
||||
static const int kMaxBurstDurationMs = 100;
|
||||
|
||||
InterArrival::InterArrival(uint32_t timestamp_group_length_ticks,
|
||||
double timestamp_to_ms_coeff,
|
||||
@ -46,6 +47,7 @@ bool InterArrival::ComputeDeltas(uint32_t timestamp,
|
||||
// have two frames of data to process.
|
||||
current_timestamp_group_.timestamp = timestamp;
|
||||
current_timestamp_group_.first_timestamp = timestamp;
|
||||
current_timestamp_group_.first_arrival_ms = arrival_time_ms;
|
||||
} else if (!PacketInOrder(timestamp)) {
|
||||
return false;
|
||||
} else if (NewTimestampGroup(arrival_time_ms, timestamp)) {
|
||||
@ -93,6 +95,7 @@ bool InterArrival::ComputeDeltas(uint32_t timestamp,
|
||||
// The new timestamp is now the current frame.
|
||||
current_timestamp_group_.first_timestamp = timestamp;
|
||||
current_timestamp_group_.timestamp = timestamp;
|
||||
current_timestamp_group_.first_arrival_ms = arrival_time_ms;
|
||||
current_timestamp_group_.size = 0;
|
||||
} else {
|
||||
current_timestamp_group_.timestamp =
|
||||
@ -147,8 +150,12 @@ bool InterArrival::BelongsToBurst(int64_t arrival_time_ms,
|
||||
if (ts_delta_ms == 0)
|
||||
return true;
|
||||
int propagation_delta_ms = arrival_time_delta_ms - ts_delta_ms;
|
||||
return propagation_delta_ms < 0 &&
|
||||
arrival_time_delta_ms <= kBurstDeltaThresholdMs;
|
||||
if (propagation_delta_ms < 0 &&
|
||||
arrival_time_delta_ms <= kBurstDeltaThresholdMs &&
|
||||
arrival_time_ms - current_timestamp_group_.first_arrival_ms <
|
||||
kMaxBurstDurationMs)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void InterArrival::Reset() {
|
||||
|
||||
@ -54,13 +54,18 @@ class InterArrival {
|
||||
private:
|
||||
struct TimestampGroup {
|
||||
TimestampGroup()
|
||||
: size(0), first_timestamp(0), timestamp(0), complete_time_ms(-1) {}
|
||||
: size(0),
|
||||
first_timestamp(0),
|
||||
timestamp(0),
|
||||
first_arrival_ms(-1),
|
||||
complete_time_ms(-1) {}
|
||||
|
||||
bool IsFirstPacket() const { return complete_time_ms == -1; }
|
||||
|
||||
size_t size;
|
||||
uint32_t first_timestamp;
|
||||
uint32_t timestamp;
|
||||
int64_t first_arrival_ms;
|
||||
int64_t complete_time_ms;
|
||||
int64_t last_system_time_ms;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user