Added experiment to improve handling of frame length changes in NetEq.

The field trial effects two things: after a frame length change the IAT
histogram is scaled to prevent an immediate change in target buffer
level. Also, the peak history in the delay peak detector is cleared, 
because the size of the peaks is stored in number of packets (which
will be incorrect after a frame length change).

Bug: webrtc:8381
Change-Id: I214b990f6e5959b655b6542884a7f75da181a0d8
Reviewed-on: https://webrtc-review.googlesource.com/8101
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20284}
This commit is contained in:
Ivo Creusen
2017-10-13 12:37:27 +02:00
committed by Commit Bot
parent e759223418
commit 385b10bbaa
7 changed files with 160 additions and 11 deletions

View File

@ -14,6 +14,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/safe_conversions.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
@ -29,7 +30,9 @@ DelayPeakDetector::~DelayPeakDetector() = default;
DelayPeakDetector::DelayPeakDetector(const TickTimer* tick_timer)
: peak_found_(false),
peak_detection_threshold_(0),
tick_timer_(tick_timer) {
tick_timer_(tick_timer),
frame_length_change_experiment_(
field_trial::IsEnabled("WebRTC-Audio-NetEqFramelengthExperiment")) {
RTC_DCHECK(!peak_period_stopwatch_);
}
@ -42,7 +45,14 @@ void DelayPeakDetector::Reset() {
// Calculates the threshold in number of packets.
void DelayPeakDetector::SetPacketAudioLength(int length_ms) {
if (length_ms > 0) {
peak_detection_threshold_ = kPeakHeightMs / length_ms;
if (frame_length_change_experiment_) {
peak_detection_threshold_ = std::max(2, kPeakHeightMs / length_ms);
} else {
peak_detection_threshold_ = kPeakHeightMs / length_ms;
}
}
if (frame_length_change_experiment_) {
peak_history_.clear();
}
}