Fix clang style warnings in webrtc/modules/audio_coding/neteq
Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.
BUG=163
R=henrik.lundin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/44109004
Cr-Commit-Position: refs/heads/master@{#8960}
diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn
index 7a053a9..8db2930 100644
--- a/webrtc/modules/audio_coding/BUILD.gn
+++ b/webrtc/modules/audio_coding/BUILD.gn
@@ -757,12 +757,6 @@
":neteq_config",
]
- if (is_clang) {
- # Suppress warnings from Chrome's Clang plugins.
- # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
- configs -= [ "//build/config/clang:find_bad_constructs" ]
- }
-
deps = [
":audio_decoder_interface",
":cng",
diff --git a/webrtc/modules/audio_coding/neteq/accelerate.h b/webrtc/modules/audio_coding/neteq/accelerate.h
index 6e3aa46..36bc094 100644
--- a/webrtc/modules/audio_coding/neteq/accelerate.h
+++ b/webrtc/modules/audio_coding/neteq/accelerate.h
@@ -34,8 +34,6 @@
: TimeStretch(sample_rate_hz, num_channels, background_noise) {
}
- virtual ~Accelerate() {}
-
// This method performs the actual Accelerate operation. The samples are
// read from |input|, of length |input_length| elements, and are written to
// |output|. The number of samples removed through time-stretching is
diff --git a/webrtc/modules/audio_coding/neteq/audio_classifier.cc b/webrtc/modules/audio_coding/neteq/audio_classifier.cc
index cc4bc97..4a8c6fb 100644
--- a/webrtc/modules/audio_coding/neteq/audio_classifier.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_classifier.cc
@@ -68,4 +68,8 @@
return is_music_;
}
+bool AudioClassifier::is_music() const {
+ return is_music_;
+}
+
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/neteq/audio_classifier.h b/webrtc/modules/audio_coding/neteq/audio_classifier.h
index 2812ea2..b32f9d5 100644
--- a/webrtc/modules/audio_coding/neteq/audio_classifier.h
+++ b/webrtc/modules/audio_coding/neteq/audio_classifier.h
@@ -37,7 +37,7 @@
bool Analysis(const int16_t* input, int input_length, int channels);
// Gets the current classification : true = music, false = speech.
- virtual bool is_music() const { return is_music_; }
+ virtual bool is_music() const;
// Gets the current music probability.
float music_probability() const { return music_probability_; }
diff --git a/webrtc/modules/audio_coding/neteq/audio_multi_vector.cc b/webrtc/modules/audio_coding/neteq/audio_multi_vector.cc
index b19eef9..1381895 100644
--- a/webrtc/modules/audio_coding/neteq/audio_multi_vector.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_multi_vector.cc
@@ -183,6 +183,10 @@
}
}
+size_t AudioMultiVector::Channels() const {
+ return num_channels_;
+}
+
size_t AudioMultiVector::Size() const {
assert(channels_[0]);
return channels_[0]->Size();
diff --git a/webrtc/modules/audio_coding/neteq/audio_multi_vector.h b/webrtc/modules/audio_coding/neteq/audio_multi_vector.h
index 27f377e..0aae9e3 100644
--- a/webrtc/modules/audio_coding/neteq/audio_multi_vector.h
+++ b/webrtc/modules/audio_coding/neteq/audio_multi_vector.h
@@ -106,7 +106,7 @@
size_t fade_length);
// Returns the number of channels.
- virtual size_t Channels() const { return num_channels_; }
+ virtual size_t Channels() const;
// Returns the number of elements per channel in this AudioMultiVector.
virtual size_t Size() const;
diff --git a/webrtc/modules/audio_coding/neteq/audio_vector.cc b/webrtc/modules/audio_coding/neteq/audio_vector.cc
index d0f1aca..fa16481 100644
--- a/webrtc/modules/audio_coding/neteq/audio_vector.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.cc
@@ -18,6 +18,21 @@
namespace webrtc {
+AudioVector::AudioVector()
+ : array_(new int16_t[kDefaultInitialSize]),
+ first_free_ix_(0),
+ capacity_(kDefaultInitialSize) {
+}
+
+AudioVector::AudioVector(size_t initial_size)
+ : array_(new int16_t[initial_size]),
+ first_free_ix_(initial_size),
+ capacity_(initial_size) {
+ memset(array_.get(), 0, initial_size * sizeof(int16_t));
+}
+
+AudioVector::~AudioVector() = default;
+
void AudioVector::Clear() {
first_free_ix_ = 0;
}
@@ -145,6 +160,16 @@
PushBack(&append_this[fade_length], samples_to_push_back);
}
+// Returns the number of elements in this AudioVector.
+size_t AudioVector::Size() const {
+ return first_free_ix_;
+}
+
+// Returns true if this AudioVector is empty.
+bool AudioVector::Empty() const {
+ return first_free_ix_ == 0;
+}
+
const int16_t& AudioVector::operator[](size_t index) const {
return array_[index];
}
diff --git a/webrtc/modules/audio_coding/neteq/audio_vector.h b/webrtc/modules/audio_coding/neteq/audio_vector.h
index 28e53ee..b44fbff 100644
--- a/webrtc/modules/audio_coding/neteq/audio_vector.h
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.h
@@ -22,20 +22,12 @@
class AudioVector {
public:
// Creates an empty AudioVector.
- AudioVector()
- : array_(new int16_t[kDefaultInitialSize]),
- first_free_ix_(0),
- capacity_(kDefaultInitialSize) {}
+ AudioVector();
// Creates an AudioVector with an initial size.
- explicit AudioVector(size_t initial_size)
- : array_(new int16_t[initial_size]),
- first_free_ix_(initial_size),
- capacity_(initial_size) {
- memset(array_.get(), 0, initial_size * sizeof(int16_t));
- }
+ explicit AudioVector(size_t initial_size);
- virtual ~AudioVector() {}
+ virtual ~AudioVector();
// Deletes all values and make the vector empty.
virtual void Clear();
@@ -94,10 +86,10 @@
virtual void CrossFade(const AudioVector& append_this, size_t fade_length);
// Returns the number of elements in this AudioVector.
- virtual size_t Size() const { return first_free_ix_; }
+ virtual size_t Size() const;
// Returns true if this AudioVector is empty.
- virtual bool Empty() const { return (first_free_ix_ == 0); }
+ virtual bool Empty() const;
// Accesses and modifies an element of AudioVector.
const int16_t& operator[](size_t index) const;
diff --git a/webrtc/modules/audio_coding/neteq/buffer_level_filter.cc b/webrtc/modules/audio_coding/neteq/buffer_level_filter.cc
index 0388b19..93f9a55 100644
--- a/webrtc/modules/audio_coding/neteq/buffer_level_filter.cc
+++ b/webrtc/modules/audio_coding/neteq/buffer_level_filter.cc
@@ -57,4 +57,9 @@
level_factor_ = 254;
}
}
+
+int BufferLevelFilter::filtered_current_level() const {
+ return filtered_current_level_;
+}
+
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/neteq/buffer_level_filter.h b/webrtc/modules/audio_coding/neteq/buffer_level_filter.h
index 48f7f56..2d2a888 100644
--- a/webrtc/modules/audio_coding/neteq/buffer_level_filter.h
+++ b/webrtc/modules/audio_coding/neteq/buffer_level_filter.h
@@ -34,7 +34,7 @@
// filter coefficient.
virtual void SetTargetBufferLevel(int target_buffer_level);
- virtual int filtered_current_level() const { return filtered_current_level_; }
+ virtual int filtered_current_level() const;
private:
int level_factor_; // Filter factor for the buffer level filter in Q8.
diff --git a/webrtc/modules/audio_coding/neteq/decision_logic_fax.h b/webrtc/modules/audio_coding/neteq/decision_logic_fax.h
index 97c481d..d9f8db9 100644
--- a/webrtc/modules/audio_coding/neteq/decision_logic_fax.h
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_fax.h
@@ -34,9 +34,6 @@
buffer_level_filter) {
}
- // Destructor.
- virtual ~DecisionLogicFax() {}
-
protected:
// Returns the operation that should be done next. |sync_buffer| and |expand|
// are provided for reference. |decoder_frame_length| is the number of samples
diff --git a/webrtc/modules/audio_coding/neteq/decision_logic_normal.h b/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
index a339d16..0254839 100644
--- a/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
@@ -34,9 +34,6 @@
buffer_level_filter) {
}
- // Destructor.
- virtual ~DecisionLogicNormal() {}
-
protected:
static const int kAllowMergeWithoutExpandMs = 20; // 20 ms.
static const int kReinitAfterExpands = 100;
@@ -51,12 +48,13 @@
// should be set to true. The output variable |reset_decoder| will be set to
// true if a reset is required; otherwise it is left unchanged (i.e., it can
// remain true if it was true before the call).
- virtual Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer,
- const Expand& expand,
- int decoder_frame_length,
- const RTPHeader* packet_header,
- Modes prev_mode, bool play_dtmf,
- bool* reset_decoder);
+ Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer,
+ const Expand& expand,
+ int decoder_frame_length,
+ const RTPHeader* packet_header,
+ Modes prev_mode,
+ bool play_dtmf,
+ bool* reset_decoder) override;
// Returns the operation to do given that the expected packet is not
// available, but a packet further into the future is at hand.
diff --git a/webrtc/modules/audio_coding/neteq/delay_peak_detector.cc b/webrtc/modules/audio_coding/neteq/delay_peak_detector.cc
index 5996d7d..712c778 100644
--- a/webrtc/modules/audio_coding/neteq/delay_peak_detector.cc
+++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector.cc
@@ -21,6 +21,8 @@
// peak-mode is engaged and the DelayManager asks the DelayPeakDetector for
// the worst peak height.
+DelayPeakDetector::~DelayPeakDetector() = default;
+
DelayPeakDetector::DelayPeakDetector()
: peak_found_(false),
peak_detection_threshold_(0),
@@ -40,6 +42,10 @@
}
}
+bool DelayPeakDetector::peak_found() {
+ return peak_found_;
+}
+
int DelayPeakDetector::MaxPeakHeight() const {
int max_height = -1; // Returns -1 for an empty history.
std::list<Peak>::const_iterator it;
diff --git a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h
index 8bf6aba..bf8ab74 100644
--- a/webrtc/modules/audio_coding/neteq/delay_peak_detector.h
+++ b/webrtc/modules/audio_coding/neteq/delay_peak_detector.h
@@ -22,7 +22,7 @@
class DelayPeakDetector {
public:
DelayPeakDetector();
- virtual ~DelayPeakDetector() {}
+ virtual ~DelayPeakDetector();
virtual void Reset();
// Notifies the DelayPeakDetector of how much audio data is carried in each
@@ -31,7 +31,7 @@
// Returns true if peak-mode is active. That is, delay peaks were observed
// recently.
- virtual bool peak_found() { return peak_found_; }
+ virtual bool peak_found();
// Calculates and returns the maximum delay peak height. Returns -1 if no
// delay peaks have been observed recently. The unit is number of packets.
diff --git a/webrtc/modules/audio_coding/neteq/dtmf_buffer.cc b/webrtc/modules/audio_coding/neteq/dtmf_buffer.cc
index b07d561..24aa9fe 100644
--- a/webrtc/modules/audio_coding/neteq/dtmf_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/dtmf_buffer.cc
@@ -20,6 +20,16 @@
namespace webrtc {
+DtmfBuffer::DtmfBuffer(int fs_hz) {
+ SetSampleRate(fs_hz);
+}
+
+DtmfBuffer::~DtmfBuffer() = default;
+
+void DtmfBuffer::Flush() {
+ buffer_.clear();
+}
+
// The ParseEvent method parses 4 bytes from |payload| according to this format
// from RFC 4733:
//
@@ -173,6 +183,14 @@
return false;
}
+size_t DtmfBuffer::Length() const {
+ return buffer_.size();
+}
+
+bool DtmfBuffer::Empty() const {
+ return buffer_.empty();
+}
+
int DtmfBuffer::SetSampleRate(int fs_hz) {
if (fs_hz != 8000 &&
fs_hz != 16000 &&
diff --git a/webrtc/modules/audio_coding/neteq/dtmf_buffer.h b/webrtc/modules/audio_coding/neteq/dtmf_buffer.h
index 5da3a16..861a948 100644
--- a/webrtc/modules/audio_coding/neteq/dtmf_buffer.h
+++ b/webrtc/modules/audio_coding/neteq/dtmf_buffer.h
@@ -55,14 +55,12 @@
};
// Set up the buffer for use at sample rate |fs_hz|.
- explicit DtmfBuffer(int fs_hz) {
- SetSampleRate(fs_hz);
- }
+ explicit DtmfBuffer(int fs_hz);
- virtual ~DtmfBuffer() {}
+ virtual ~DtmfBuffer();
// Flushes the buffer.
- virtual void Flush() { buffer_.clear(); }
+ virtual void Flush();
// Static method to parse 4 bytes from |payload| as a DTMF event (RFC 4733)
// and write the parsed information into the struct |event|. Input variable
@@ -82,9 +80,9 @@
virtual bool GetEvent(uint32_t current_timestamp, DtmfEvent* event);
// Number of events in the buffer.
- virtual size_t Length() const { return buffer_.size(); }
+ virtual size_t Length() const;
- virtual bool Empty() const { return buffer_.empty(); }
+ virtual bool Empty() const;
// Set a new sample rate.
virtual int SetSampleRate(int fs_hz);
diff --git a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
index 3429bcd..45601c0 100644
--- a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
+++ b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc
@@ -189,4 +189,8 @@
return num_samples;
}
+bool DtmfToneGenerator::initialized() const {
+ return initialized_;
+}
+
} // namespace webrtc
diff --git a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h
index 232eba4..4e51e53 100644
--- a/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h
+++ b/webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h
@@ -31,7 +31,7 @@
virtual int Init(int fs, int event, int attenuation);
virtual void Reset();
virtual int Generate(int num_samples, AudioMultiVector* output);
- virtual bool initialized() const { return initialized_; }
+ virtual bool initialized() const;
private:
static const int kCoeff1[4][16]; // 1st oscillator model coefficient table.
diff --git a/webrtc/modules/audio_coding/neteq/expand.cc b/webrtc/modules/audio_coding/neteq/expand.cc
index d13c2cd..15d7a84 100644
--- a/webrtc/modules/audio_coding/neteq/expand.cc
+++ b/webrtc/modules/audio_coding/neteq/expand.cc
@@ -24,6 +24,32 @@
namespace webrtc {
+Expand::Expand(BackgroundNoise* background_noise,
+ SyncBuffer* sync_buffer,
+ RandomVector* random_vector,
+ int fs,
+ size_t num_channels)
+ : random_vector_(random_vector),
+ sync_buffer_(sync_buffer),
+ first_expand_(true),
+ fs_hz_(fs),
+ num_channels_(num_channels),
+ consecutive_expands_(0),
+ background_noise_(background_noise),
+ overlap_length_(5 * fs / 8000),
+ lag_index_direction_(0),
+ current_lag_index_(0),
+ stop_muting_(false),
+ channel_parameters_(new ChannelParameters[num_channels_]) {
+ assert(fs == 8000 || fs == 16000 || fs == 32000 || fs == 48000);
+ assert(fs <= kMaxSampleRate); // Should not be possible.
+ assert(num_channels_ > 0);
+ memset(expand_lags_, 0, sizeof(expand_lags_));
+ Reset();
+}
+
+Expand::~Expand() = default;
+
void Expand::Reset() {
first_expand_ = true;
consecutive_expands_ = 0;
@@ -289,6 +315,10 @@
stop_muting_ = true;
}
+size_t Expand::overlap_length() const {
+ return overlap_length_;
+}
+
void Expand::InitializeForAnExpandPeriod() {
lag_index_direction_ = 1;
current_lag_index_ = -1;
@@ -712,6 +742,18 @@
}
}
+Expand::ChannelParameters::ChannelParameters()
+ : mute_factor(16384),
+ ar_gain(0),
+ ar_gain_scale(0),
+ voice_mix_factor(0),
+ current_voice_mix_factor(0),
+ onset(false),
+ mute_slope(0) {
+ memset(ar_filter, 0, sizeof(ar_filter));
+ memset(ar_filter_state, 0, sizeof(ar_filter_state));
+}
+
int16_t Expand::Correlation(const int16_t* input, size_t input_length,
int16_t* output, int16_t* output_scale) const {
// Set parameters depending on sample rate.
diff --git a/webrtc/modules/audio_coding/neteq/expand.h b/webrtc/modules/audio_coding/neteq/expand.h
index 7b41114..674813f 100644
--- a/webrtc/modules/audio_coding/neteq/expand.h
+++ b/webrtc/modules/audio_coding/neteq/expand.h
@@ -35,27 +35,9 @@
SyncBuffer* sync_buffer,
RandomVector* random_vector,
int fs,
- size_t num_channels)
- : random_vector_(random_vector),
- sync_buffer_(sync_buffer),
- first_expand_(true),
- fs_hz_(fs),
- num_channels_(num_channels),
- consecutive_expands_(0),
- background_noise_(background_noise),
- overlap_length_(5 * fs / 8000),
- lag_index_direction_(0),
- current_lag_index_(0),
- stop_muting_(false),
- channel_parameters_(new ChannelParameters[num_channels_]) {
- assert(fs == 8000 || fs == 16000 || fs == 32000 || fs == 48000);
- assert(fs <= kMaxSampleRate); // Should not be possible.
- assert(num_channels_ > 0);
- memset(expand_lags_, 0, sizeof(expand_lags_));
- Reset();
- }
+ size_t num_channels);
- virtual ~Expand() {}
+ virtual ~Expand();
// Resets the object.
virtual void Reset();
@@ -85,7 +67,7 @@
}
// Accessors and mutators.
- virtual size_t overlap_length() const { return overlap_length_; }
+ virtual size_t overlap_length() const;
int16_t max_lag() const { return max_lag_; }
protected:
@@ -126,18 +108,7 @@
static const int kNumLags = 3;
struct ChannelParameters {
- // Constructor.
- ChannelParameters()
- : mute_factor(16384),
- ar_gain(0),
- ar_gain_scale(0),
- voice_mix_factor(0),
- current_voice_mix_factor(0),
- onset(false),
- mute_slope(0) {
- memset(ar_filter, 0, sizeof(ar_filter));
- memset(ar_filter_state, 0, sizeof(ar_filter_state));
- }
+ ChannelParameters();
int16_t mute_factor;
int16_t ar_filter[kUnvoicedLpcOrder + 1];
int16_t ar_filter_state[kUnvoicedLpcOrder];
diff --git a/webrtc/modules/audio_coding/neteq/merge.cc b/webrtc/modules/audio_coding/neteq/merge.cc
index bc22000..0de2439 100644
--- a/webrtc/modules/audio_coding/neteq/merge.cc
+++ b/webrtc/modules/audio_coding/neteq/merge.cc
@@ -24,6 +24,20 @@
namespace webrtc {
+Merge::Merge(int fs_hz,
+ size_t num_channels,
+ Expand* expand,
+ SyncBuffer* sync_buffer)
+ : fs_hz_(fs_hz),
+ num_channels_(num_channels),
+ fs_mult_(fs_hz_ / 8000),
+ timestamps_per_call_(fs_hz_ / 100),
+ expand_(expand),
+ sync_buffer_(sync_buffer),
+ expanded_(num_channels_) {
+ assert(num_channels_ > 0);
+}
+
int Merge::Process(int16_t* input, size_t input_length,
int16_t* external_mute_factor_array,
AudioMultiVector* output) {
diff --git a/webrtc/modules/audio_coding/neteq/merge.h b/webrtc/modules/audio_coding/neteq/merge.h
index 1bf0483..1b60aec 100644
--- a/webrtc/modules/audio_coding/neteq/merge.h
+++ b/webrtc/modules/audio_coding/neteq/merge.h
@@ -33,17 +33,10 @@
// what the Merge class does.
class Merge {
public:
- Merge(int fs_hz, size_t num_channels, Expand* expand, SyncBuffer* sync_buffer)
- : fs_hz_(fs_hz),
- num_channels_(num_channels),
- fs_mult_(fs_hz_ / 8000),
- timestamps_per_call_(fs_hz_ / 100),
- expand_(expand),
- sync_buffer_(sync_buffer),
- expanded_(num_channels_) {
- assert(num_channels_ > 0);
- }
-
+ Merge(int fs_hz,
+ size_t num_channels,
+ Expand* expand,
+ SyncBuffer* sync_buffer);
virtual ~Merge() {}
// The main method to produce the audio data. The decoded data is supplied in
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 32c6629..784174f 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -281,6 +281,18 @@
return delay_manager_->least_required_delay_ms();
}
+int NetEqImpl::SetTargetDelay() {
+ return kNotImplemented;
+}
+
+int NetEqImpl::TargetDelay() {
+ return kNotImplemented;
+}
+
+int NetEqImpl::CurrentDelay() {
+ return kNotImplemented;
+}
+
// Deprecated.
// TODO(henrik.lundin) Delete.
void NetEqImpl::SetPlayoutMode(NetEqPlayoutMode mode) {
@@ -354,6 +366,14 @@
return true;
}
+int NetEqImpl::SetTargetNumberOfChannels() {
+ return kNotImplemented;
+}
+
+int NetEqImpl::SetTargetSampleRate() {
+ return kNotImplemented;
+}
+
int NetEqImpl::LastError() const {
CriticalSectionScoped lock(crit_sect_.get());
return error_code_;
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.h b/webrtc/modules/audio_coding/neteq/neteq_impl.h
index ac4689b..76b23e3 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.h
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.h
@@ -73,7 +73,7 @@
PreemptiveExpandFactory* preemptive_expand_factory,
bool create_components = true);
- virtual ~NetEqImpl();
+ ~NetEqImpl() override;
// Inserts a new packet into NetEq. The |receive_timestamp| is an indication
// of the time when the packet was received, and should be measured with
@@ -133,11 +133,11 @@
int LeastRequiredDelayMs() const override;
- int SetTargetDelay() override { return kNotImplemented; }
+ int SetTargetDelay() override;
- int TargetDelay() override { return kNotImplemented; }
+ int TargetDelay() override;
- int CurrentDelay() override { return kNotImplemented; }
+ int CurrentDelay() override;
// Sets the playout mode to |mode|.
// Deprecated.
@@ -174,9 +174,9 @@
bool GetPlayoutTimestamp(uint32_t* timestamp) override;
- int SetTargetNumberOfChannels() override { return kNotImplemented; }
+ int SetTargetNumberOfChannels() override;
- int SetTargetSampleRate() override { return kNotImplemented; }
+ int SetTargetSampleRate() override;
// Returns the error code for the last occurred error. If no error has
// occurred, 0 is returned.
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.cc b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
index b0c939b..08b237f 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
@@ -49,6 +49,10 @@
DeleteAllPackets(&buffer_);
}
+bool PacketBuffer::Empty() const {
+ return buffer_.empty();
+}
+
int PacketBuffer::InsertPacket(Packet* packet) {
if (!packet || !packet->payload) {
if (packet) {
@@ -229,6 +233,14 @@
return 0;
}
+int PacketBuffer::DiscardAllOldPackets(uint32_t timestamp_limit) {
+ return DiscardOldPackets(timestamp_limit, 0);
+}
+
+int PacketBuffer::NumPacketsInBuffer() const {
+ return static_cast<int>(buffer_.size());
+}
+
int PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database,
int last_decoded_length) const {
PacketList::const_iterator it;
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.h b/webrtc/modules/audio_coding/neteq/packet_buffer.h
index b9a1618..d2d429b 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.h
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.h
@@ -43,7 +43,7 @@
virtual void Flush();
// Returns true for an empty buffer.
- virtual bool Empty() const { return buffer_.empty(); }
+ virtual bool Empty() const;
// Inserts |packet| into the buffer. The buffer will take over ownership of
// the packet object.
@@ -105,15 +105,11 @@
uint32_t horizon_samples);
// Discards all packets that are (strictly) older than timestamp_limit.
- virtual int DiscardAllOldPackets(uint32_t timestamp_limit) {
- return DiscardOldPackets(timestamp_limit, 0);
- }
+ virtual int DiscardAllOldPackets(uint32_t timestamp_limit);
// Returns the number of packets in the buffer, including duplicates and
// redundant packets.
- virtual int NumPacketsInBuffer() const {
- return static_cast<int>(buffer_.size());
- }
+ virtual int NumPacketsInBuffer() const;
// Returns the number of samples in the buffer, including samples carried in
// duplicate and redundant packets.
diff --git a/webrtc/modules/audio_coding/neteq/preemptive_expand.h b/webrtc/modules/audio_coding/neteq/preemptive_expand.h
index 1aa6133..750c16b 100644
--- a/webrtc/modules/audio_coding/neteq/preemptive_expand.h
+++ b/webrtc/modules/audio_coding/neteq/preemptive_expand.h
@@ -38,8 +38,6 @@
overlap_samples_(overlap_samples) {
}
- virtual ~PreemptiveExpand() {}
-
// This method performs the actual PreemptiveExpand operation. The samples are
// read from |input|, of length |input_length| elements, and are written to
// |output|. The number of samples added through time-stretching is
@@ -54,16 +52,18 @@
protected:
// Sets the parameters |best_correlation| and |peak_index| to suitable
// values when the signal contains no active speech.
- virtual void SetParametersForPassiveSpeech(size_t len,
- int16_t* w16_bestCorr,
- int* w16_bestIndex) const;
+ void SetParametersForPassiveSpeech(size_t len,
+ int16_t* w16_bestCorr,
+ int* w16_bestIndex) const override;
// Checks the criteria for performing the time-stretching operation and,
// if possible, performs the time-stretching.
- virtual ReturnCodes CheckCriteriaAndStretch(
- const int16_t *pw16_decoded, size_t len, size_t w16_bestIndex,
- int16_t w16_bestCorr, bool w16_VAD,
- AudioMultiVector* output) const;
+ ReturnCodes CheckCriteriaAndStretch(const int16_t* pw16_decoded,
+ size_t len,
+ size_t w16_bestIndex,
+ int16_t w16_bestCorr,
+ bool w16_VAD,
+ AudioMultiVector* output) const override;
private:
int old_data_length_per_channel_;
diff --git a/webrtc/modules/audio_coding/neteq/sync_buffer.h b/webrtc/modules/audio_coding/neteq/sync_buffer.h
index 59bd4d8..bbb494e 100644
--- a/webrtc/modules/audio_coding/neteq/sync_buffer.h
+++ b/webrtc/modules/audio_coding/neteq/sync_buffer.h
@@ -25,8 +25,6 @@
end_timestamp_(0),
dtmf_index_(0) {}
- virtual ~SyncBuffer() {}
-
// Returns the number of samples yet to play out form the buffer.
size_t FutureLength() const;
@@ -34,7 +32,7 @@
// the same number of samples from the beginning of the SyncBuffer, to
// maintain a constant buffer size. The |next_index_| is updated to reflect
// the move of the beginning of "future" data.
- void PushBack(const AudioMultiVector& append_this);
+ void PushBack(const AudioMultiVector& append_this) override;
// Adds |length| zeros to the beginning of each channel. Removes
// the same number of samples from the end of the SyncBuffer, to
diff --git a/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc b/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
index 11d5a20..8bc0f2d 100644
--- a/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
+++ b/webrtc/modules/audio_coding/neteq/timestamp_scaler.cc
@@ -16,6 +16,10 @@
namespace webrtc {
+void TimestampScaler::Reset() {
+ first_packet_received_ = false;
+}
+
void TimestampScaler::ToInternal(Packet* packet) {
if (!packet) {
return;
diff --git a/webrtc/modules/audio_coding/neteq/timestamp_scaler.h b/webrtc/modules/audio_coding/neteq/timestamp_scaler.h
index 59b8cc7..fcbb773 100644
--- a/webrtc/modules/audio_coding/neteq/timestamp_scaler.h
+++ b/webrtc/modules/audio_coding/neteq/timestamp_scaler.h
@@ -36,7 +36,7 @@
virtual ~TimestampScaler() {}
// Start over.
- virtual void Reset() { first_packet_received_ = false; }
+ virtual void Reset();
// Scale the timestamp in |packet| from external to internal.
virtual void ToInternal(Packet* packet);