Delete AudioCodingModule::LeastRequiredDelayMs and related NetEq code.
Bug: None Change-Id: I2f68502d19415899b3694f7bf5da523da831b223 Reviewed-on: https://webrtc-review.googlesource.com/95640 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24439}
This commit is contained in:
@ -60,10 +60,6 @@ int AcmReceiver::SetMaximumDelay(int delay_ms) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AcmReceiver::LeastRequiredDelayMs() const {
|
||||
return neteq_->LeastRequiredDelayMs();
|
||||
}
|
||||
|
||||
absl::optional<int> AcmReceiver::last_packet_sample_rate_hz() const {
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
return last_packet_sample_rate_hz_;
|
||||
|
||||
@ -142,13 +142,6 @@ class AcmReceiver {
|
||||
//
|
||||
int SetMaximumDelay(int delay_ms);
|
||||
|
||||
//
|
||||
// Get least required delay computed based on channel conditions. Note that
|
||||
// this is before applying any user-defined limits (specified by calling
|
||||
// (SetMinimumDelay() and/or SetMaximumDelay()).
|
||||
//
|
||||
int LeastRequiredDelayMs() const;
|
||||
|
||||
//
|
||||
// Resets the initial delay to zero.
|
||||
//
|
||||
|
||||
@ -155,9 +155,6 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||
// Maximum playout delay.
|
||||
int SetMaximumPlayoutDelay(int time_ms) override;
|
||||
|
||||
// Smallest latency NetEq will maintain.
|
||||
int LeastRequiredDelayMs() const override;
|
||||
|
||||
absl::optional<uint32_t> PlayoutTimestamp() override;
|
||||
|
||||
int FilteredCurrentDelayMs() const override;
|
||||
@ -1207,10 +1204,6 @@ std::vector<uint16_t> AudioCodingModuleImpl::GetNackList(
|
||||
return receiver_.GetNackList(round_trip_time_ms);
|
||||
}
|
||||
|
||||
int AudioCodingModuleImpl::LeastRequiredDelayMs() const {
|
||||
return receiver_.LeastRequiredDelayMs();
|
||||
}
|
||||
|
||||
void AudioCodingModuleImpl::GetDecodingCallStatistics(
|
||||
AudioDecodingCallStats* call_stats) const {
|
||||
receiver_.GetDecodingCallStatistics(call_stats);
|
||||
|
||||
@ -602,15 +602,6 @@ class AudioCodingModule {
|
||||
//
|
||||
virtual int SetMaximumPlayoutDelay(int time_ms) = 0;
|
||||
|
||||
// TODO(kwiberg): Consider if this is needed anymore, now that voe::Channel
|
||||
// doesn't use it.
|
||||
// The shortest latency, in milliseconds, required by jitter buffer. This
|
||||
// is computed based on inter-arrival times and playout mode of NetEq. The
|
||||
// actual delay is the maximum of least-required-delay and the minimum-delay
|
||||
// specified by SetMinumumPlayoutDelay() API.
|
||||
//
|
||||
virtual int LeastRequiredDelayMs() const = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t PlayoutTimestamp()
|
||||
// The send timestamp of an RTP packet is associated with the decoded
|
||||
|
||||
@ -40,7 +40,6 @@ DelayManager::DelayManager(size_t max_packets_in_buffer,
|
||||
last_seq_no_(0),
|
||||
last_timestamp_(0),
|
||||
minimum_delay_ms_(0),
|
||||
least_required_delay_ms_(target_level_),
|
||||
maximum_delay_ms_(target_level_),
|
||||
iat_cumulative_sum_(0),
|
||||
max_iat_cumulative_sum_(0),
|
||||
@ -234,8 +233,6 @@ void DelayManager::UpdateHistogram(size_t iat_packets) {
|
||||
// |least_required_level_| while the above limits are applied.
|
||||
// TODO(hlundin): Move this check to the buffer logistics class.
|
||||
void DelayManager::LimitTargetLevel() {
|
||||
least_required_delay_ms_ = (target_level_ * packet_len_ms_) >> 8;
|
||||
|
||||
if (packet_len_ms_ > 0 && minimum_delay_ms_ > 0) {
|
||||
int minimum_delay_packet_q8 = (minimum_delay_ms_ << 8) / packet_len_ms_;
|
||||
target_level_ = std::max(target_level_, minimum_delay_packet_q8);
|
||||
@ -467,10 +464,6 @@ bool DelayManager::SetMaximumDelay(int delay_ms) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int DelayManager::least_required_delay_ms() const {
|
||||
return least_required_delay_ms_;
|
||||
}
|
||||
|
||||
int DelayManager::base_target_level() const {
|
||||
return base_target_level_;
|
||||
}
|
||||
|
||||
@ -109,7 +109,6 @@ class DelayManager {
|
||||
// Assuming |delay| is in valid range.
|
||||
virtual bool SetMinimumDelay(int delay_ms);
|
||||
virtual bool SetMaximumDelay(int delay_ms);
|
||||
virtual int least_required_delay_ms() const;
|
||||
virtual int base_target_level() const;
|
||||
virtual void set_streaming_mode(bool value);
|
||||
virtual int last_pack_cng_or_dtmf() const;
|
||||
@ -161,10 +160,6 @@ class DelayManager {
|
||||
uint16_t last_seq_no_; // Sequence number for last received packet.
|
||||
uint32_t last_timestamp_; // Timestamp for the last received packet.
|
||||
int minimum_delay_ms_; // Externally set minimum delay.
|
||||
int least_required_delay_ms_; // Smallest preferred buffer level (same unit
|
||||
// as |target_level_|), before applying
|
||||
// |minimum_delay_ms_| and/or
|
||||
// |maximum_delay_ms_|.
|
||||
int maximum_delay_ms_; // Externally set maximum allowed delay.
|
||||
int iat_cumulative_sum_; // Cumulative sum of delta inter-arrival times.
|
||||
int max_iat_cumulative_sum_; // Max of |iat_cumulative_sum_|.
|
||||
|
||||
@ -200,7 +200,7 @@ TEST_F(DelayManagerTest, TargetDelay) {
|
||||
EXPECT_EQ(lower + (20 << 8) / kFrameSizeMs, higher);
|
||||
}
|
||||
|
||||
TEST_F(DelayManagerTest, MaxAndRequiredDelay) {
|
||||
TEST_F(DelayManagerTest, MaxDelay) {
|
||||
const int kExpectedTarget = 5;
|
||||
const int kTimeIncrement = kExpectedTarget * kFrameSizeMs;
|
||||
SetPacketAudioLength(kFrameSizeMs);
|
||||
@ -224,14 +224,13 @@ TEST_F(DelayManagerTest, MaxAndRequiredDelay) {
|
||||
EXPECT_TRUE(dm_->SetMaximumDelay(kMaxDelayMs));
|
||||
IncreaseTime(kTimeIncrement);
|
||||
InsertNextPacket();
|
||||
EXPECT_EQ(kExpectedTarget * kFrameSizeMs, dm_->least_required_delay_ms());
|
||||
EXPECT_EQ(kMaxDelayPackets << 8, dm_->TargetLevel());
|
||||
|
||||
// Target level at least should be one packet.
|
||||
EXPECT_FALSE(dm_->SetMaximumDelay(kFrameSizeMs - 1));
|
||||
}
|
||||
|
||||
TEST_F(DelayManagerTest, MinAndRequiredDelay) {
|
||||
TEST_F(DelayManagerTest, MinDelay) {
|
||||
const int kExpectedTarget = 5;
|
||||
const int kTimeIncrement = kExpectedTarget * kFrameSizeMs;
|
||||
SetPacketAudioLength(kFrameSizeMs);
|
||||
@ -255,7 +254,6 @@ TEST_F(DelayManagerTest, MinAndRequiredDelay) {
|
||||
dm_->SetMinimumDelay(kMinDelayMs);
|
||||
IncreaseTime(kTimeIncrement);
|
||||
InsertNextPacket();
|
||||
EXPECT_EQ(kExpectedTarget * kFrameSizeMs, dm_->least_required_delay_ms());
|
||||
EXPECT_EQ(kMinDelayPackets << 8, dm_->TargetLevel());
|
||||
}
|
||||
|
||||
|
||||
@ -180,12 +180,6 @@ class NetEq {
|
||||
// the |max_delay_ms| value in the NetEq::Config struct.
|
||||
virtual bool SetMaximumDelay(int delay_ms) = 0;
|
||||
|
||||
// The smallest latency required. This is computed bases on inter-arrival
|
||||
// time and internal NetEq logic. Note that in computing this latency none of
|
||||
// the user defined limits (applied by calling setMinimumDelay() and/or
|
||||
// SetMaximumDelay()) are applied.
|
||||
virtual int LeastRequiredDelayMs() const = 0;
|
||||
|
||||
// Not implemented.
|
||||
virtual int SetTargetDelay() = 0;
|
||||
|
||||
|
||||
@ -307,12 +307,6 @@ bool NetEqImpl::SetMaximumDelay(int delay_ms) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int NetEqImpl::LeastRequiredDelayMs() const {
|
||||
rtc::CritScope lock(&crit_sect_);
|
||||
assert(delay_manager_.get());
|
||||
return delay_manager_->least_required_delay_ms();
|
||||
}
|
||||
|
||||
int NetEqImpl::SetTargetDelay() {
|
||||
return kNotImplemented;
|
||||
}
|
||||
|
||||
@ -157,8 +157,6 @@ class NetEqImpl : public webrtc::NetEq {
|
||||
|
||||
bool SetMaximumDelay(int delay_ms) override;
|
||||
|
||||
int LeastRequiredDelayMs() const override;
|
||||
|
||||
int SetTargetDelay() override;
|
||||
|
||||
int TargetDelayMs() const override;
|
||||
|
||||
@ -57,18 +57,6 @@ class TargetDelayTest : public ::testing::Test {
|
||||
EXPECT_EQ(-1, SetMinimumDelay(10001));
|
||||
}
|
||||
|
||||
void NoTargetDelayBufferSizeChanges() {
|
||||
for (int n = 0; n < 30; ++n) // Run enough iterations.
|
||||
Run(true);
|
||||
int clean_optimal_delay = GetCurrentOptimalDelayMs();
|
||||
Run(false); // Run with jitter.
|
||||
int jittery_optimal_delay = GetCurrentOptimalDelayMs();
|
||||
EXPECT_GT(jittery_optimal_delay, clean_optimal_delay);
|
||||
int required_delay = RequiredDelay();
|
||||
EXPECT_GT(required_delay, 0);
|
||||
EXPECT_NEAR(required_delay, jittery_optimal_delay, 1);
|
||||
}
|
||||
|
||||
void WithTargetDelayBufferNotChanging() {
|
||||
// A target delay that is one packet larger than jitter.
|
||||
const int kTargetDelayMs =
|
||||
@ -83,37 +71,6 @@ class TargetDelayTest : public ::testing::Test {
|
||||
EXPECT_EQ(jittery_optimal_delay, clean_optimal_delay);
|
||||
}
|
||||
|
||||
void RequiredDelayAtCorrectRange() {
|
||||
for (int n = 0; n < 30; ++n) // Run clean and store delay.
|
||||
Run(true);
|
||||
int clean_optimal_delay = GetCurrentOptimalDelayMs();
|
||||
|
||||
// A relatively large delay.
|
||||
const int kTargetDelayMs =
|
||||
(kInterarrivalJitterPacket + 10) * kNum10msPerFrame * 10;
|
||||
ASSERT_EQ(0, SetMinimumDelay(kTargetDelayMs));
|
||||
for (int n = 0; n < 300; ++n) // Run enough iterations to fill the buffer.
|
||||
Run(true);
|
||||
Run(false); // Run with jitter.
|
||||
|
||||
int jittery_optimal_delay = GetCurrentOptimalDelayMs();
|
||||
EXPECT_EQ(kTargetDelayMs, jittery_optimal_delay);
|
||||
|
||||
int required_delay = RequiredDelay();
|
||||
|
||||
// Checking |required_delay| is in correct range.
|
||||
EXPECT_GT(required_delay, 0);
|
||||
EXPECT_GT(jittery_optimal_delay, required_delay);
|
||||
EXPECT_GT(required_delay, clean_optimal_delay);
|
||||
|
||||
// A tighter check for the value of |required_delay|.
|
||||
// The jitter forces a delay of
|
||||
// |kInterarrivalJitterPacket * kNum10msPerFrame * 10| milliseconds. So we
|
||||
// expect |required_delay| be close to that.
|
||||
EXPECT_NEAR(kInterarrivalJitterPacket * kNum10msPerFrame * 10,
|
||||
required_delay, 1);
|
||||
}
|
||||
|
||||
void TargetDelayBufferMinMax() {
|
||||
const int kTargetMinDelayMs = kNum10msPerFrame * 10;
|
||||
ASSERT_EQ(0, SetMinimumDelay(kTargetMinDelayMs));
|
||||
@ -193,8 +150,6 @@ class TargetDelayTest : public ::testing::Test {
|
||||
return stats.preferredBufferSize;
|
||||
}
|
||||
|
||||
int RequiredDelay() { return acm_->LeastRequiredDelayMs(); }
|
||||
|
||||
std::unique_ptr<AudioCodingModule> acm_;
|
||||
WebRtcRTPHeader rtp_info_;
|
||||
uint8_t payload_[kPayloadLenBytes];
|
||||
@ -210,17 +165,6 @@ TEST_F(TargetDelayTest, MAYBE_OutOfRangeInput) {
|
||||
OutOfRangeInput();
|
||||
}
|
||||
|
||||
// Flaky on iOS: webrtc:7057.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
#define MAYBE_NoTargetDelayBufferSizeChanges \
|
||||
DISABLED_NoTargetDelayBufferSizeChanges
|
||||
#else
|
||||
#define MAYBE_NoTargetDelayBufferSizeChanges NoTargetDelayBufferSizeChanges
|
||||
#endif
|
||||
TEST_F(TargetDelayTest, MAYBE_NoTargetDelayBufferSizeChanges) {
|
||||
NoTargetDelayBufferSizeChanges();
|
||||
}
|
||||
|
||||
// Flaky on iOS: webrtc:7057.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
#define MAYBE_WithTargetDelayBufferNotChanging \
|
||||
@ -232,16 +176,6 @@ TEST_F(TargetDelayTest, MAYBE_WithTargetDelayBufferNotChanging) {
|
||||
WithTargetDelayBufferNotChanging();
|
||||
}
|
||||
|
||||
// Flaky on iOS: webrtc:7057.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
#define MAYBE_RequiredDelayAtCorrectRange DISABLED_RequiredDelayAtCorrectRange
|
||||
#else
|
||||
#define MAYBE_RequiredDelayAtCorrectRange RequiredDelayAtCorrectRange
|
||||
#endif
|
||||
TEST_F(TargetDelayTest, MAYBE_RequiredDelayAtCorrectRange) {
|
||||
RequiredDelayAtCorrectRange();
|
||||
}
|
||||
|
||||
// Flaky on iOS: webrtc:7057.
|
||||
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||
#define MAYBE_TargetDelayBufferMinMax DISABLED_TargetDelayBufferMinMax
|
||||
|
||||
Reference in New Issue
Block a user