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}
This commit is contained in:
@ -757,12 +757,6 @@ source_set("neteq") {
|
||||
":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",
|
||||
|
||||
@ -34,8 +34,6 @@ class Accelerate : public TimeStretch {
|
||||
: 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
|
||||
|
||||
@ -68,4 +68,8 @@ bool AudioClassifier::Analysis(const int16_t* input,
|
||||
return is_music_;
|
||||
}
|
||||
|
||||
bool AudioClassifier::is_music() const {
|
||||
return is_music_;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -37,7 +37,7 @@ class AudioClassifier {
|
||||
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_; }
|
||||
|
||||
@ -183,6 +183,10 @@ void AudioMultiVector::CrossFade(const AudioMultiVector& append_this,
|
||||
}
|
||||
}
|
||||
|
||||
size_t AudioMultiVector::Channels() const {
|
||||
return num_channels_;
|
||||
}
|
||||
|
||||
size_t AudioMultiVector::Size() const {
|
||||
assert(channels_[0]);
|
||||
return channels_[0]->Size();
|
||||
|
||||
@ -106,7 +106,7 @@ class AudioMultiVector {
|
||||
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;
|
||||
|
||||
@ -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 @@ void AudioVector::CrossFade(const AudioVector& append_this,
|
||||
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];
|
||||
}
|
||||
|
||||
@ -22,20 +22,12 @@ namespace webrtc {
|
||||
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 @@ class AudioVector {
|
||||
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;
|
||||
|
||||
@ -57,4 +57,9 @@ void BufferLevelFilter::SetTargetBufferLevel(int target_buffer_level) {
|
||||
level_factor_ = 254;
|
||||
}
|
||||
}
|
||||
|
||||
int BufferLevelFilter::filtered_current_level() const {
|
||||
return filtered_current_level_;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -34,7 +34,7 @@ class BufferLevelFilter {
|
||||
// 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.
|
||||
|
||||
@ -34,9 +34,6 @@ class DecisionLogicFax : public DecisionLogic {
|
||||
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
|
||||
|
||||
@ -34,9 +34,6 @@ class DecisionLogicNormal : public DecisionLogic {
|
||||
buffer_level_filter) {
|
||||
}
|
||||
|
||||
// Destructor.
|
||||
virtual ~DecisionLogicNormal() {}
|
||||
|
||||
protected:
|
||||
static const int kAllowMergeWithoutExpandMs = 20; // 20 ms.
|
||||
static const int kReinitAfterExpands = 100;
|
||||
@ -51,12 +48,13 @@ class DecisionLogicNormal : public DecisionLogic {
|
||||
// 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.
|
||||
|
||||
@ -21,6 +21,8 @@ namespace webrtc {
|
||||
// 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 @@ void DelayPeakDetector::SetPacketAudioLength(int length_ms) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace webrtc {
|
||||
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 @@ class DelayPeakDetector {
|
||||
|
||||
// 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.
|
||||
|
||||
@ -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 @@ bool DtmfBuffer::GetEvent(uint32_t current_timestamp, DtmfEvent* event) {
|
||||
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 &&
|
||||
|
||||
@ -55,14 +55,12 @@ class DtmfBuffer {
|
||||
};
|
||||
|
||||
// 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 @@ class DtmfBuffer {
|
||||
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);
|
||||
|
||||
@ -189,4 +189,8 @@ int DtmfToneGenerator::Generate(int num_samples,
|
||||
return num_samples;
|
||||
}
|
||||
|
||||
bool DtmfToneGenerator::initialized() const {
|
||||
return initialized_;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -31,7 +31,7 @@ class DtmfToneGenerator {
|
||||
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.
|
||||
|
||||
@ -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 @@ void Expand::SetParametersForMergeAfterExpand() {
|
||||
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 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
@ -35,27 +35,9 @@ class Expand {
|
||||
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 @@ class Expand {
|
||||
}
|
||||
|
||||
// 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 @@ class Expand {
|
||||
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];
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -33,17 +33,10 @@ class SyncBuffer;
|
||||
// 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
|
||||
|
||||
@ -281,6 +281,18 @@ int NetEqImpl::LeastRequiredDelayMs() const {
|
||||
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 @@ bool NetEqImpl::GetPlayoutTimestamp(uint32_t* timestamp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int NetEqImpl::SetTargetNumberOfChannels() {
|
||||
return kNotImplemented;
|
||||
}
|
||||
|
||||
int NetEqImpl::SetTargetSampleRate() {
|
||||
return kNotImplemented;
|
||||
}
|
||||
|
||||
int NetEqImpl::LastError() const {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
return error_code_;
|
||||
|
||||
@ -73,7 +73,7 @@ class NetEqImpl : public webrtc::NetEq {
|
||||
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 @@ class NetEqImpl : public webrtc::NetEq {
|
||||
|
||||
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 @@ class NetEqImpl : public webrtc::NetEq {
|
||||
|
||||
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.
|
||||
|
||||
@ -49,6 +49,10 @@ void PacketBuffer::Flush() {
|
||||
DeleteAllPackets(&buffer_);
|
||||
}
|
||||
|
||||
bool PacketBuffer::Empty() const {
|
||||
return buffer_.empty();
|
||||
}
|
||||
|
||||
int PacketBuffer::InsertPacket(Packet* packet) {
|
||||
if (!packet || !packet->payload) {
|
||||
if (packet) {
|
||||
@ -229,6 +233,14 @@ int PacketBuffer::DiscardOldPackets(uint32_t timestamp_limit,
|
||||
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;
|
||||
|
||||
@ -43,7 +43,7 @@ class PacketBuffer {
|
||||
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 @@ class PacketBuffer {
|
||||
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.
|
||||
|
||||
@ -38,8 +38,6 @@ class PreemptiveExpand : public TimeStretch {
|
||||
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 @@ class PreemptiveExpand : public TimeStretch {
|
||||
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_;
|
||||
|
||||
@ -25,8 +25,6 @@ class SyncBuffer : public AudioMultiVector {
|
||||
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 @@ class SyncBuffer : public AudioMultiVector {
|
||||
// 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
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
void TimestampScaler::Reset() {
|
||||
first_packet_received_ = false;
|
||||
}
|
||||
|
||||
void TimestampScaler::ToInternal(Packet* packet) {
|
||||
if (!packet) {
|
||||
return;
|
||||
|
||||
@ -36,7 +36,7 @@ class TimestampScaler {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user