diff --git a/modules/remote_bitrate_estimator/inter_arrival.cc b/modules/remote_bitrate_estimator/inter_arrival.cc index b779e41797..3a0f579052 100644 --- a/modules/remote_bitrate_estimator/inter_arrival.cc +++ b/modules/remote_bitrate_estimator/inter_arrival.cc @@ -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() { diff --git a/modules/remote_bitrate_estimator/inter_arrival.h b/modules/remote_bitrate_estimator/inter_arrival.h index f46bf4425d..f2facd47c2 100644 --- a/modules/remote_bitrate_estimator/inter_arrival.h +++ b/modules/remote_bitrate_estimator/inter_arrival.h @@ -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; };