Remove inter-arrival delay mode from DelayManager.

Also remove the delay peak detector which is no longer used.

This should be a no-op since relative arrival delay mode is used by default.

Bug: webrtc:10333
Change-Id: Ifa326b762d52f16f9dc5f3da2874139faf1022da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164462
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30179}
This commit is contained in:
Jakob Ivarsson
2020-01-07 17:07:40 +01:00
committed by Commit Bot
parent 57218b4e22
commit bd5874accf
14 changed files with 18 additions and 714 deletions

View File

@ -17,7 +17,6 @@
#include <memory>
#include "modules/audio_coding/neteq/histogram.h"
#include "modules/audio_coding/neteq/mock/mock_delay_peak_detector.h"
#include "modules/audio_coding/neteq/mock/mock_histogram.h"
#include "modules/audio_coding/neteq/mock/mock_statistics_calculator.h"
#include "rtc_base/checks.h"
@ -47,7 +46,6 @@ class DelayManagerTest : public ::testing::Test {
protected:
DelayManagerTest();
virtual void SetUp();
virtual void TearDown();
void RecreateDelayManager();
void SetPacketAudioLength(int lengt_ms);
absl::optional<int> InsertNextPacket();
@ -56,19 +54,15 @@ class DelayManagerTest : public ::testing::Test {
std::unique_ptr<DelayManager> dm_;
TickTimer tick_timer_;
MockStatisticsCalculator stats_;
MockDelayPeakDetector detector_;
MockHistogram* mock_histogram_;
uint16_t seq_no_;
uint32_t ts_;
bool enable_rtx_handling_ = false;
bool use_mock_histogram_ = false;
DelayManager::HistogramMode histogram_mode_ =
DelayManager::HistogramMode::RELATIVE_ARRIVAL_DELAY;
};
DelayManagerTest::DelayManagerTest()
: dm_(nullptr),
detector_(&tick_timer_, false),
seq_no_(0x1234),
ts_(0x12345678) {}
@ -77,22 +71,19 @@ void DelayManagerTest::SetUp() {
}
void DelayManagerTest::RecreateDelayManager() {
EXPECT_CALL(detector_, Reset()).Times(1);
if (use_mock_histogram_) {
mock_histogram_ = new MockHistogram(kMaxIat, kForgetFactor);
std::unique_ptr<Histogram> histogram(mock_histogram_);
dm_ = std::make_unique<DelayManager>(
kMaxNumberOfPackets, kMinDelayMs, kDefaultHistogramQuantile,
histogram_mode_, enable_rtx_handling_, &detector_, &tick_timer_,
std::move(histogram));
enable_rtx_handling_, &tick_timer_, std::move(histogram));
} else {
dm_ = DelayManager::Create(kMaxNumberOfPackets, kMinDelayMs,
enable_rtx_handling_, &detector_, &tick_timer_);
enable_rtx_handling_, &tick_timer_);
}
}
void DelayManagerTest::SetPacketAudioLength(int lengt_ms) {
EXPECT_CALL(detector_, SetPacketAudioLength(lengt_ms));
dm_->SetPacketAudioLength(lengt_ms);
}
@ -109,10 +100,6 @@ void DelayManagerTest::IncreaseTime(int inc_ms) {
}
}
void DelayManagerTest::TearDown() {
EXPECT_CALL(detector_, Die());
}
TEST_F(DelayManagerTest, CreateAndDestroy) {
// Nothing to do here. The test fixture creates and destroys the DelayManager
// object.
@ -120,23 +107,10 @@ TEST_F(DelayManagerTest, CreateAndDestroy) {
TEST_F(DelayManagerTest, SetPacketAudioLength) {
const int kLengthMs = 30;
// Expect DelayManager to pass on the new length to the detector object.
EXPECT_CALL(detector_, SetPacketAudioLength(kLengthMs)).Times(1);
EXPECT_EQ(0, dm_->SetPacketAudioLength(kLengthMs));
EXPECT_EQ(-1, dm_->SetPacketAudioLength(-1)); // Illegal parameter value.
}
TEST_F(DelayManagerTest, PeakFound) {
// Expect DelayManager to pass on the question to the detector.
// Call twice, and let the detector return true the first time and false the
// second time.
EXPECT_CALL(detector_, peak_found())
.WillOnce(Return(true))
.WillOnce(Return(false));
EXPECT_TRUE(dm_->PeakFound());
EXPECT_FALSE(dm_->PeakFound());
}
TEST_F(DelayManagerTest, UpdateNormal) {
SetPacketAudioLength(kFrameSizeMs);
// First packet arrival.
@ -495,8 +469,6 @@ TEST_F(DelayManagerTest, DelayHistogramFieldTrial) {
test::ScopedFieldTrials field_trial(
"WebRTC-Audio-NetEqDelayHistogram/Enabled-96-0.998/");
RecreateDelayManager();
EXPECT_EQ(DelayManager::HistogramMode::RELATIVE_ARRIVAL_DELAY,
dm_->histogram_mode());
EXPECT_EQ(1030792151, dm_->histogram_quantile()); // 0.96 in Q30.
EXPECT_EQ(
32702,
@ -507,8 +479,6 @@ TEST_F(DelayManagerTest, DelayHistogramFieldTrial) {
test::ScopedFieldTrials field_trial(
"WebRTC-Audio-NetEqDelayHistogram/Enabled-97.5-0.998/");
RecreateDelayManager();
EXPECT_EQ(DelayManager::HistogramMode::RELATIVE_ARRIVAL_DELAY,
dm_->histogram_mode());
EXPECT_EQ(1046898278, dm_->histogram_quantile()); // 0.975 in Q30.
EXPECT_EQ(
32702,
@ -536,8 +506,7 @@ TEST_F(DelayManagerTest, DelayHistogramFieldTrial) {
}
}
TEST_F(DelayManagerTest, RelativeArrivalDelayMode) {
histogram_mode_ = DelayManager::HistogramMode::RELATIVE_ARRIVAL_DELAY;
TEST_F(DelayManagerTest, RelativeArrivalDelay) {
use_mock_histogram_ = true;
RecreateDelayManager();
@ -561,7 +530,6 @@ TEST_F(DelayManagerTest, RelativeArrivalDelayMode) {
}
TEST_F(DelayManagerTest, MaxDelayHistory) {
histogram_mode_ = DelayManager::HistogramMode::RELATIVE_ARRIVAL_DELAY;
use_mock_histogram_ = true;
RecreateDelayManager();