Delete support for enabling adaptive isac mode
This appears unused. If deleted, other code related to isac bandwidth
estimation becomes unused and may be deleted in followup cls.
Bug: webrtc:10098
Change-Id: Ifeac2e90de895b12c337ea28cc33704350b9abf4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153667
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29252}
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 8c5fb00..43b1d9b 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -370,15 +370,13 @@
]
}
-rtc_static_library("isac_common") {
+rtc_source_set("isac_common") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/audio_decoder_isac_t.h",
"codecs/isac/audio_decoder_isac_t_impl.h",
"codecs/isac/audio_encoder_isac_t.h",
"codecs/isac/audio_encoder_isac_t_impl.h",
- "codecs/isac/locked_bandwidth_info.cc",
- "codecs/isac/locked_bandwidth_info.h",
]
deps = [
":isac_bwinfo",
diff --git a/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h b/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h
index 1e6560f..9af7054 100644
--- a/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h
+++ b/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h
@@ -16,7 +16,6 @@
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/scoped_refptr.h"
-#include "modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
#include "rtc_base/constructor_magic.h"
namespace webrtc {
@@ -26,7 +25,6 @@
public:
struct Config {
bool IsOk() const;
- rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo;
int sample_rate_hz = 16000;
};
explicit AudioDecoderIsacT(const Config& config);
@@ -52,7 +50,6 @@
private:
typename T::instance_type* isac_state_;
int sample_rate_hz_;
- rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT);
};
diff --git a/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h b/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
index 0d65517..90c61b1 100644
--- a/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
+++ b/modules/audio_coding/codecs/isac/audio_decoder_isac_t_impl.h
@@ -22,16 +22,11 @@
template <typename T>
AudioDecoderIsacT<T>::AudioDecoderIsacT(const Config& config)
- : sample_rate_hz_(config.sample_rate_hz), bwinfo_(config.bwinfo) {
+ : sample_rate_hz_(config.sample_rate_hz) {
RTC_CHECK(config.IsOk()) << "Unsupported sample rate "
<< config.sample_rate_hz;
RTC_CHECK_EQ(0, T::Create(&isac_state_));
T::DecoderInit(isac_state_);
- if (bwinfo_) {
- IsacBandwidthInfo bi;
- T::GetBandwidthInfo(isac_state_, &bi);
- bwinfo_->Set(bi);
- }
RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz_));
}
@@ -78,11 +73,6 @@
int ret = T::UpdateBwEstimate(isac_state_, payload, payload_len,
rtp_sequence_number, rtp_timestamp,
arrival_timestamp);
- if (bwinfo_) {
- IsacBandwidthInfo bwinfo;
- T::GetBandwidthInfo(isac_state_, &bwinfo);
- bwinfo_->Set(bwinfo);
- }
return ret;
}
diff --git a/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h b/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
index c6ef795..f9a4c97 100644
--- a/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
+++ b/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
@@ -15,7 +15,6 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/scoped_refptr.h"
-#include "modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
#include "rtc_base/constructor_magic.h"
namespace webrtc {
@@ -30,8 +29,6 @@
struct Config {
bool IsOk() const;
- rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo;
-
int payload_type = 103;
int sample_rate_hz = 16000;
int frame_size_ms = 30;
@@ -39,14 +36,6 @@
// rate, in bits/s.
int max_payload_size_bytes = -1;
int max_bit_rate = -1;
-
- // If true, the encoder will dynamically adjust frame size and bit rate;
- // the configured values are then merely the starting point.
- bool adaptive_mode = false;
-
- // In adaptive mode, prevent adaptive changes to the frame size. (Not used
- // in nonadaptive mode.)
- bool enforce_frame_size = false;
};
explicit AudioEncoderIsacT(const Config& config);
@@ -74,7 +63,6 @@
Config config_;
typename T::instance_type* isac_state_ = nullptr;
- rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_;
// Have we accepted input but not yet emitted it in a packet?
bool packet_in_progress_ = false;
diff --git a/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
index 3448139..7c0b1a5 100644
--- a/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
+++ b/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
@@ -21,8 +21,7 @@
return false;
if (max_payload_size_bytes < 120 && max_payload_size_bytes != -1)
return false;
- if (adaptive_mode && !bwinfo)
- return false;
+
switch (sample_rate_hz) {
case 16000:
if (max_bit_rate > 53400)
@@ -78,8 +77,6 @@
template <typename T>
int AudioEncoderIsacT<T>::GetTargetBitrate() const {
- if (config_.adaptive_mode)
- return -1;
return config_.bit_rate == 0 ? kDefaultBitRate : config_.bit_rate;
}
@@ -93,11 +90,6 @@
packet_in_progress_ = true;
packet_timestamp_ = rtp_timestamp;
}
- if (bwinfo_) {
- IsacBandwidthInfo bwinfo = bwinfo_->Get();
- T::SetBandwidthInfo(isac_state_, &bwinfo);
- }
-
size_t encoded_bytes = encoded->AppendData(
kSufficientEncodeBufferSizeBytes, [&](rtc::ArrayView<uint8_t> encoded) {
int r = T::Encode(isac_state_, audio.data(), encoded.data());
@@ -131,19 +123,14 @@
void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) {
RTC_CHECK(config.IsOk());
packet_in_progress_ = false;
- bwinfo_ = config.bwinfo;
if (isac_state_)
RTC_CHECK_EQ(0, T::Free(isac_state_));
RTC_CHECK_EQ(0, T::Create(&isac_state_));
- RTC_CHECK_EQ(0, T::EncoderInit(isac_state_, config.adaptive_mode ? 0 : 1));
+ RTC_CHECK_EQ(0, T::EncoderInit(isac_state_, 1));
RTC_CHECK_EQ(0, T::SetEncSampRate(isac_state_, config.sample_rate_hz));
const int bit_rate = config.bit_rate == 0 ? kDefaultBitRate : config.bit_rate;
- if (config.adaptive_mode) {
- RTC_CHECK_EQ(0, T::ControlBwe(isac_state_, bit_rate, config.frame_size_ms,
- config.enforce_frame_size));
- } else {
- RTC_CHECK_EQ(0, T::Control(isac_state_, bit_rate, config.frame_size_ms));
- }
+ RTC_CHECK_EQ(0, T::Control(isac_state_, bit_rate, config.frame_size_ms));
+
if (config.max_payload_size_bytes != -1)
RTC_CHECK_EQ(
0, T::SetMaxPayloadSize(isac_state_, config.max_payload_size_bytes));
diff --git a/modules/audio_coding/codecs/isac/locked_bandwidth_info.cc b/modules/audio_coding/codecs/isac/locked_bandwidth_info.cc
deleted file mode 100644
index 80d10ab..0000000
--- a/modules/audio_coding/codecs/isac/locked_bandwidth_info.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
-
-namespace webrtc {
-
-LockedIsacBandwidthInfo::LockedIsacBandwidthInfo() : ref_count_(0) {
- bwinfo_.in_use = 0;
-}
-
-LockedIsacBandwidthInfo::~LockedIsacBandwidthInfo() = default;
-
-} // namespace webrtc
diff --git a/modules/audio_coding/codecs/isac/locked_bandwidth_info.h b/modules/audio_coding/codecs/isac/locked_bandwidth_info.h
deleted file mode 100644
index 0b1bc7d..0000000
--- a/modules/audio_coding/codecs/isac/locked_bandwidth_info.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_
-#define MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_
-
-#include "modules/audio_coding/codecs/isac/bandwidth_info.h"
-#include "rtc_base/atomic_ops.h"
-#include "rtc_base/critical_section.h"
-#include "rtc_base/thread_annotations.h"
-
-namespace webrtc {
-
-// An IsacBandwidthInfo that's safe to access from multiple threads because
-// it's protected by a mutex.
-class LockedIsacBandwidthInfo final {
- public:
- LockedIsacBandwidthInfo();
- ~LockedIsacBandwidthInfo();
-
- IsacBandwidthInfo Get() const {
- rtc::CritScope lock(&lock_);
- return bwinfo_;
- }
-
- void Set(const IsacBandwidthInfo& bwinfo) {
- rtc::CritScope lock(&lock_);
- bwinfo_ = bwinfo;
- }
-
- int AddRef() const { return rtc::AtomicOps::Increment(&ref_count_); }
-
- int Release() const {
- const int count = rtc::AtomicOps::Decrement(&ref_count_);
- if (count == 0) {
- delete this;
- }
- return count;
- }
-
- private:
- mutable volatile int ref_count_;
- rtc::CriticalSection lock_;
- IsacBandwidthInfo bwinfo_ RTC_GUARDED_BY(lock_);
-};
-
-} // namespace webrtc
-
-#endif // MODULES_AUDIO_CODING_CODECS_ISAC_LOCKED_BANDWIDTH_INFO_H_
diff --git a/modules/audio_coding/neteq/audio_decoder_unittest.cc b/modules/audio_coding/neteq/audio_decoder_unittest.cc
index e58b08d..0788601 100644
--- a/modules/audio_coding/neteq/audio_decoder_unittest.cc
+++ b/modules/audio_coding/neteq/audio_decoder_unittest.cc
@@ -353,7 +353,6 @@
AudioEncoderIsacFloatImpl::Config config;
config.payload_type = payload_type_;
config.sample_rate_hz = codec_input_rate_hz_;
- config.adaptive_mode = false;
config.frame_size_ms =
1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
audio_encoder_.reset(new AudioEncoderIsacFloatImpl(config));
@@ -373,7 +372,6 @@
AudioEncoderIsacFloatImpl::Config config;
config.payload_type = payload_type_;
config.sample_rate_hz = codec_input_rate_hz_;
- config.adaptive_mode = false;
config.frame_size_ms =
1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
audio_encoder_.reset(new AudioEncoderIsacFloatImpl(config));
@@ -393,7 +391,6 @@
AudioEncoderIsacFixImpl::Config config;
config.payload_type = payload_type_;
config.sample_rate_hz = codec_input_rate_hz_;
- config.adaptive_mode = false;
config.frame_size_ms =
1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
audio_encoder_.reset(new AudioEncoderIsacFixImpl(config));