Remove unused incomplete_frame argument from JitterEstimator.
Bug: webrtc:14151 Change-Id: I6764315f0c10b304f50e4639a3e49e4ed013c41e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267842 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37443}
This commit is contained in:
@ -869,7 +869,7 @@ void VCMJitterBuffer::UpdateJitterEstimate(const VCMFrameBuffer& frame,
|
|||||||
void VCMJitterBuffer::UpdateJitterEstimate(int64_t latest_packet_time_ms,
|
void VCMJitterBuffer::UpdateJitterEstimate(int64_t latest_packet_time_ms,
|
||||||
uint32_t timestamp,
|
uint32_t timestamp,
|
||||||
unsigned int frame_size,
|
unsigned int frame_size,
|
||||||
bool incomplete_frame) {
|
bool /*incomplete_frame*/) {
|
||||||
if (latest_packet_time_ms == -1) {
|
if (latest_packet_time_ms == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -880,8 +880,7 @@ void VCMJitterBuffer::UpdateJitterEstimate(int64_t latest_packet_time_ms,
|
|||||||
// Filter out frames which have been reordered in time by the network
|
// Filter out frames which have been reordered in time by the network
|
||||||
if (not_reordered) {
|
if (not_reordered) {
|
||||||
// Update the jitter estimate with the new samples
|
// Update the jitter estimate with the new samples
|
||||||
jitter_estimate_.UpdateEstimate(*frame_delay, DataSize::Bytes(frame_size),
|
jitter_estimate_.UpdateEstimate(*frame_delay, DataSize::Bytes(frame_size));
|
||||||
incomplete_frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,8 +96,7 @@ void JitterEstimator::Reset() {
|
|||||||
|
|
||||||
// Updates the estimates with the new measurements.
|
// Updates the estimates with the new measurements.
|
||||||
void JitterEstimator::UpdateEstimate(TimeDelta frame_delay,
|
void JitterEstimator::UpdateEstimate(TimeDelta frame_delay,
|
||||||
DataSize frame_size,
|
DataSize frame_size) {
|
||||||
bool incomplete_frame /* = false */) {
|
|
||||||
if (frame_size.IsZero()) {
|
if (frame_size.IsZero()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -112,19 +111,17 @@ void JitterEstimator::UpdateEstimate(TimeDelta frame_delay,
|
|||||||
avg_frame_size_ = frame_size_sum_ / static_cast<double>(frame_size_count_);
|
avg_frame_size_ = frame_size_sum_ / static_cast<double>(frame_size_count_);
|
||||||
frame_size_count_++;
|
frame_size_count_++;
|
||||||
}
|
}
|
||||||
if (!incomplete_frame || frame_size > avg_frame_size_) {
|
|
||||||
DataSize avg_frame_size = kPhi * avg_frame_size_ + (1 - kPhi) * frame_size;
|
DataSize avg_frame_size = kPhi * avg_frame_size_ + (1 - kPhi) * frame_size;
|
||||||
DataSize deviation_size = DataSize::Bytes(2 * sqrt(var_frame_size_));
|
DataSize deviation_size = DataSize::Bytes(2 * sqrt(var_frame_size_));
|
||||||
if (frame_size < avg_frame_size_ + deviation_size) {
|
if (frame_size < avg_frame_size_ + deviation_size) {
|
||||||
// Only update the average frame size if this sample wasn't a key frame.
|
// Only update the average frame size if this sample wasn't a key frame.
|
||||||
avg_frame_size_ = avg_frame_size;
|
avg_frame_size_ = avg_frame_size;
|
||||||
}
|
}
|
||||||
// Update the variance anyway since we want to capture cases where we only
|
|
||||||
// get key frames.
|
|
||||||
double delta_bytes = frame_size.bytes() - avg_frame_size.bytes();
|
double delta_bytes = frame_size.bytes() - avg_frame_size.bytes();
|
||||||
var_frame_size_ = std::max(
|
var_frame_size_ = std::max(
|
||||||
kPhi * var_frame_size_ + (1 - kPhi) * (delta_bytes * delta_bytes), 1.0);
|
kPhi * var_frame_size_ + (1 - kPhi) * (delta_bytes * delta_bytes), 1.0);
|
||||||
}
|
|
||||||
|
|
||||||
// Update max_frame_size_ estimate.
|
// Update max_frame_size_ estimate.
|
||||||
max_frame_size_ = std::max(kPsi * max_frame_size_, frame_size);
|
max_frame_size_ = std::max(kPsi * max_frame_size_, frame_size);
|
||||||
@ -152,22 +149,21 @@ void JitterEstimator::UpdateEstimate(TimeDelta frame_delay,
|
|||||||
kNumStdDevFrameSizeOutlier * sqrt(var_frame_size_)) {
|
kNumStdDevFrameSizeOutlier * sqrt(var_frame_size_)) {
|
||||||
// Update the variance of the deviation from the line given by the Kalman
|
// Update the variance of the deviation from the line given by the Kalman
|
||||||
// filter.
|
// filter.
|
||||||
EstimateRandomJitter(deviation, incomplete_frame);
|
EstimateRandomJitter(deviation);
|
||||||
// Prevent updating with frames which have been congested by a large frame,
|
// Prevent updating with frames which have been congested by a large frame,
|
||||||
// and therefore arrives almost at the same time as that frame.
|
// and therefore arrives almost at the same time as that frame.
|
||||||
// This can occur when we receive a large frame (key frame) which has been
|
// This can occur when we receive a large frame (key frame) which has been
|
||||||
// delayed. The next frame is of normal size (delta frame), and thus deltaFS
|
// delayed. The next frame is of normal size (delta frame), and thus deltaFS
|
||||||
// will be << 0. This removes all frame samples which arrives after a key
|
// will be << 0. This removes all frame samples which arrives after a key
|
||||||
// frame.
|
// frame.
|
||||||
if ((!incomplete_frame || deviation >= 0) &&
|
if (delta_frame_bytes > -0.25 * max_frame_size_.bytes()) {
|
||||||
delta_frame_bytes > -0.25 * max_frame_size_.bytes()) {
|
|
||||||
// Update the Kalman filter with the new data
|
// Update the Kalman filter with the new data
|
||||||
KalmanEstimateChannel(frame_delay, delta_frame_bytes);
|
KalmanEstimateChannel(frame_delay, delta_frame_bytes);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int nStdDev =
|
int nStdDev =
|
||||||
(deviation >= 0) ? kNumStdDevDelayOutlier : -kNumStdDevDelayOutlier;
|
(deviation >= 0) ? kNumStdDevDelayOutlier : -kNumStdDevDelayOutlier;
|
||||||
EstimateRandomJitter(nStdDev * sqrt(var_noise_), incomplete_frame);
|
EstimateRandomJitter(nStdDev * sqrt(var_noise_));
|
||||||
}
|
}
|
||||||
// Post process the total estimated jitter
|
// Post process the total estimated jitter
|
||||||
if (startup_count_ >= kStartupDelaySamples) {
|
if (startup_count_ >= kStartupDelaySamples) {
|
||||||
@ -273,7 +269,7 @@ double JitterEstimator::DeviationFromExpectedDelay(
|
|||||||
|
|
||||||
// Estimates the random jitter by calculating the variance of the sample
|
// Estimates the random jitter by calculating the variance of the sample
|
||||||
// distance from the line given by theta.
|
// distance from the line given by theta.
|
||||||
void JitterEstimator::EstimateRandomJitter(double d_dT, bool incomplete_frame) {
|
void JitterEstimator::EstimateRandomJitter(double d_dT) {
|
||||||
Timestamp now = clock_->CurrentTime();
|
Timestamp now = clock_->CurrentTime();
|
||||||
if (last_update_time_.has_value()) {
|
if (last_update_time_.has_value()) {
|
||||||
fps_counter_.AddSample((now - *last_update_time_).us());
|
fps_counter_.AddSample((now - *last_update_time_).us());
|
||||||
@ -310,10 +306,8 @@ void JitterEstimator::EstimateRandomJitter(double d_dT, bool incomplete_frame) {
|
|||||||
double avgNoise = alpha * avg_noise_ + (1 - alpha) * d_dT;
|
double avgNoise = alpha * avg_noise_ + (1 - alpha) * d_dT;
|
||||||
double varNoise = alpha * var_noise_ +
|
double varNoise = alpha * var_noise_ +
|
||||||
(1 - alpha) * (d_dT - avg_noise_) * (d_dT - avg_noise_);
|
(1 - alpha) * (d_dT - avg_noise_) * (d_dT - avg_noise_);
|
||||||
if (!incomplete_frame || varNoise > var_noise_) {
|
|
||||||
avg_noise_ = avgNoise;
|
avg_noise_ = avgNoise;
|
||||||
var_noise_ = varNoise;
|
var_noise_ = varNoise;
|
||||||
}
|
|
||||||
if (var_noise_ < 1.0) {
|
if (var_noise_ < 1.0) {
|
||||||
// The variance should never be zero, since we might get stuck and consider
|
// The variance should never be zero, since we might get stuck and consider
|
||||||
// all samples as outliers.
|
// all samples as outliers.
|
||||||
|
|||||||
@ -39,12 +39,7 @@ class JitterEstimator {
|
|||||||
// Input:
|
// Input:
|
||||||
// - frame_delay : Delay-delta calculated by UTILDelayEstimate.
|
// - frame_delay : Delay-delta calculated by UTILDelayEstimate.
|
||||||
// - frame_size : Frame size of the current frame.
|
// - frame_size : Frame size of the current frame.
|
||||||
// - incomplete_frame : Flags if the frame is used to update the
|
void UpdateEstimate(TimeDelta frame_delay, DataSize frame_size);
|
||||||
// estimate before it was complete.
|
|
||||||
// Default is false.
|
|
||||||
void UpdateEstimate(TimeDelta frame_delay,
|
|
||||||
DataSize frame_size,
|
|
||||||
bool incomplete_frame = false);
|
|
||||||
|
|
||||||
// Returns the current jitter estimate and adds an RTT dependent term in cases
|
// Returns the current jitter estimate and adds an RTT dependent term in cases
|
||||||
// of retransmission.
|
// of retransmission.
|
||||||
@ -94,9 +89,7 @@ class JitterEstimator {
|
|||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - d_dT : The deviation from the kalman estimate.
|
// - d_dT : The deviation from the kalman estimate.
|
||||||
// - incomplete_frame : True if the frame used to update the
|
void EstimateRandomJitter(double d_dT);
|
||||||
// estimate with was incomplete.
|
|
||||||
void EstimateRandomJitter(double d_dT, bool incomplete_frame);
|
|
||||||
|
|
||||||
double NoiseThreshold() const;
|
double NoiseThreshold() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user