Remove minimum bucket returned by histogram quantile function.
This fixes a bug in delay manager relative arrival delay mode that caused the effective minimum target level to be 2 packets instead of 1. Bug: webrtc:10333 Change-Id: I33d32c8da692a3db22179edb923873d307f740fd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150785 Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Reviewed-by: Minyue Li <minyue@webrtc.org> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29002}
This commit is contained in:
committed by
Commit Bot
parent
b4a6128e28
commit
a2479f7dc4
@ -116,14 +116,14 @@ int Histogram::Quantile(int probability) {
|
||||
int inverse_probability = (1 << 30) - probability;
|
||||
size_t index = 0; // Start from the beginning of |buckets_|.
|
||||
int sum = 1 << 30; // Assign to 1 in Q30.
|
||||
sum -= buckets_[index]; // Ensure that target level is >= 1.
|
||||
sum -= buckets_[index];
|
||||
|
||||
do {
|
||||
while ((sum > inverse_probability) && (index < buckets_.size() - 1)) {
|
||||
// Subtract the probabilities one by one until the sum is no longer greater
|
||||
// than |inverse_probability|.
|
||||
++index;
|
||||
sum -= buckets_[index];
|
||||
} while ((sum > inverse_probability) && (index < buckets_.size() - 1));
|
||||
}
|
||||
return static_cast<int>(index);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user