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}
This commit is contained in:
Niels Möller
2019-09-19 15:21:54 +02:00
committed by Commit Bot
parent b5e4785464
commit 48b32b748e
8 changed files with 6 additions and 126 deletions

View File

@ -370,15 +370,13 @@ rtc_source_set("ilbc_c") {
]
}
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",

View File

@ -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 @@ class AudioDecoderIsacT final : public AudioDecoder {
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 @@ class AudioDecoderIsacT final : public AudioDecoder {
private:
typename T::instance_type* isac_state_;
int sample_rate_hz_;
rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT);
};

View File

@ -22,16 +22,11 @@ bool AudioDecoderIsacT<T>::Config::IsOk() const {
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 AudioDecoderIsacT<T>::IncomingPacket(const uint8_t* payload,
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;
}

View File

@ -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 @@ class AudioEncoderIsacT final : public AudioEncoder {
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 @@ class AudioEncoderIsacT final : public AudioEncoder {
// 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 @@ class AudioEncoderIsacT final : public AudioEncoder {
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;

View File

@ -21,8 +21,7 @@ bool AudioEncoderIsacT<T>::Config::IsOk() const {
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 @@ size_t AudioEncoderIsacT<T>::Max10MsFramesInAPacket() const {
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 @@ AudioEncoder::EncodedInfo AudioEncoderIsacT<T>::EncodeImpl(
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 @@ template <typename T>
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));
}
if (config.max_payload_size_bytes != -1)
RTC_CHECK_EQ(
0, T::SetMaxPayloadSize(isac_state_, config.max_payload_size_bytes));

View File

@ -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

View File

@ -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_

View File

@ -353,7 +353,6 @@ class AudioDecoderIsacFloatTest : public AudioDecoderTest {
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 @@ class AudioDecoderIsacSwbTest : public AudioDecoderTest {
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 @@ class AudioDecoderIsacFixTest : public AudioDecoderTest {
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));