diff options
author | Peter Kasting <pkasting@google.com> | 2016-01-12 16:26:35 -0800 |
---|---|---|
committer | Peter Kasting <pkasting@google.com> | 2016-01-13 00:26:55 +0000 |
commit | 6955870806624479723addfae6dcf5d13968796c (patch) | |
tree | af7b10a4564c7e49d29fbb4ee37767abaded7e32 /webrtc/modules/audio_processing | |
parent | 92e677a1f8d24dfa0031d307c4a7d8e530cd4eb4 (diff) | |
download | webrtc-6955870806624479723addfae6dcf5d13968796c.tar.gz |
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
Diffstat (limited to 'webrtc/modules/audio_processing')
42 files changed, 321 insertions, 296 deletions
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc index 77bda79a0c..ff64267e8c 100644 --- a/webrtc/modules/audio_processing/audio_buffer.cc +++ b/webrtc/modules/audio_processing/audio_buffer.cc @@ -44,9 +44,9 @@ size_t NumBandsFromSamplesPerChannel(size_t num_frames) { } // namespace AudioBuffer::AudioBuffer(size_t input_num_frames, - int num_input_channels, + size_t num_input_channels, size_t process_num_frames, - int num_process_channels, + size_t num_process_channels, size_t output_num_frames) : input_num_frames_(input_num_frames), num_input_channels_(num_input_channels), @@ -74,7 +74,7 @@ AudioBuffer::AudioBuffer(size_t input_num_frames, num_proc_channels_)); if (input_num_frames_ != proc_num_frames_) { - for (int i = 0; i < num_proc_channels_; ++i) { + for (size_t i = 0; i < num_proc_channels_; ++i) { input_resamplers_.push_back( new PushSincResampler(input_num_frames_, proc_num_frames_)); @@ -82,7 +82,7 @@ AudioBuffer::AudioBuffer(size_t input_num_frames, } if (output_num_frames_ != proc_num_frames_) { - for (int i = 0; i < num_proc_channels_; ++i) { + for (size_t i = 0; i < num_proc_channels_; ++i) { output_resamplers_.push_back( new PushSincResampler(proc_num_frames_, output_num_frames_)); @@ -130,7 +130,7 @@ void AudioBuffer::CopyFrom(const float* const* data, // Resample. if (input_num_frames_ != proc_num_frames_) { - for (int i = 0; i < num_proc_channels_; ++i) { + for (size_t i = 0; i < num_proc_channels_; ++i) { input_resamplers_[i]->Resample(data_ptr[i], input_num_frames_, process_buffer_->channels()[i], @@ -140,7 +140,7 @@ void AudioBuffer::CopyFrom(const float* const* data, } // Convert to the S16 range. - for (int i = 0; i < num_proc_channels_; ++i) { + for (size_t i = 0; i < num_proc_channels_; ++i) { FloatToFloatS16(data_ptr[i], proc_num_frames_, data_->fbuf()->channels()[i]); @@ -158,7 +158,7 @@ void AudioBuffer::CopyTo(const StreamConfig& stream_config, // Convert to an intermediate buffer for subsequent resampling. data_ptr = process_buffer_->channels(); } - for (int i = 0; i < num_channels_; ++i) { + for (size_t i = 0; i < num_channels_; ++i) { FloatS16ToFloat(data_->fbuf()->channels()[i], proc_num_frames_, data_ptr[i]); @@ -166,7 +166,7 @@ void AudioBuffer::CopyTo(const StreamConfig& stream_config, // Resample. if (output_num_frames_ != proc_num_frames_) { - for (int i = 0; i < num_channels_; ++i) { + for (size_t i = 0; i < num_channels_; ++i) { output_resamplers_[i]->Resample(data_ptr[i], proc_num_frames_, data[i], @@ -175,7 +175,7 @@ void AudioBuffer::CopyTo(const StreamConfig& stream_config, } // Upmix. - for (int i = num_channels_; i < stream_config.num_channels(); ++i) { + for (size_t i = num_channels_; i < stream_config.num_channels(); ++i) { memcpy(data[i], data[0], output_num_frames_ * sizeof(**data)); } } @@ -197,13 +197,13 @@ int16_t* const* AudioBuffer::channels() { return data_->ibuf()->channels(); } -const int16_t* const* AudioBuffer::split_bands_const(int channel) const { +const int16_t* const* AudioBuffer::split_bands_const(size_t channel) const { return split_data_.get() ? split_data_->ibuf_const()->bands(channel) : data_->ibuf_const()->bands(channel); } -int16_t* const* AudioBuffer::split_bands(int channel) { +int16_t* const* AudioBuffer::split_bands(size_t channel) { mixed_low_pass_valid_ = false; return split_data_.get() ? split_data_->ibuf()->bands(channel) : @@ -254,13 +254,13 @@ float* const* AudioBuffer::channels_f() { return data_->fbuf()->channels(); } -const float* const* AudioBuffer::split_bands_const_f(int channel) const { +const float* const* AudioBuffer::split_bands_const_f(size_t channel) const { return split_data_.get() ? split_data_->fbuf_const()->bands(channel) : data_->fbuf_const()->bands(channel); } -float* const* AudioBuffer::split_bands_f(int channel) { +float* const* AudioBuffer::split_bands_f(size_t channel) { mixed_low_pass_valid_ = false; return split_data_.get() ? split_data_->fbuf()->bands(channel) : @@ -341,11 +341,11 @@ AudioFrame::VADActivity AudioBuffer::activity() const { return activity_; } -int AudioBuffer::num_channels() const { +size_t AudioBuffer::num_channels() const { return num_channels_; } -void AudioBuffer::set_num_channels(int num_channels) { +void AudioBuffer::set_num_channels(size_t num_channels) { num_channels_ = num_channels; } @@ -398,7 +398,7 @@ void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) { // Resample. if (input_num_frames_ != proc_num_frames_) { - for (int i = 0; i < num_proc_channels_; ++i) { + for (size_t i = 0; i < num_proc_channels_; ++i) { input_resamplers_[i]->Resample(input_buffer_->fbuf_const()->channels()[i], input_num_frames_, data_->fbuf()->channels()[i], @@ -423,7 +423,7 @@ void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) { output_buffer_.reset( new IFChannelBuffer(output_num_frames_, num_channels_)); } - for (int i = 0; i < num_channels_; ++i) { + for (size_t i = 0; i < num_channels_; ++i) { output_resamplers_[i]->Resample( data_->fbuf()->channels()[i], proc_num_frames_, output_buffer_->fbuf()->channels()[i], output_num_frames_); @@ -448,7 +448,7 @@ void AudioBuffer::CopyLowPassToReference() { new ChannelBuffer<int16_t>(num_split_frames_, num_proc_channels_)); } - for (int i = 0; i < num_proc_channels_; i++) { + for (size_t i = 0; i < num_proc_channels_; i++) { memcpy(low_pass_reference_channels_->channels()[i], split_bands_const(i)[kBand0To8kHz], low_pass_reference_channels_->num_frames_per_band() * diff --git a/webrtc/modules/audio_processing/audio_buffer.h b/webrtc/modules/audio_processing/audio_buffer.h index 48c9488eb7..ff12ca2d95 100644 --- a/webrtc/modules/audio_processing/audio_buffer.h +++ b/webrtc/modules/audio_processing/audio_buffer.h @@ -34,14 +34,14 @@ class AudioBuffer { public: // TODO(ajm): Switch to take ChannelLayouts. AudioBuffer(size_t input_num_frames, - int num_input_channels, + size_t num_input_channels, size_t process_num_frames, - int num_process_channels, + size_t num_process_channels, size_t output_num_frames); virtual ~AudioBuffer(); - int num_channels() const; - void set_num_channels(int num_channels); + size_t num_channels() const; + void set_num_channels(size_t num_channels); size_t num_frames() const; size_t num_frames_per_band() const; size_t num_keyboard_frames() const; @@ -65,10 +65,10 @@ class AudioBuffer { // 0 <= channel < |num_proc_channels_| // 0 <= band < |num_bands_| // 0 <= sample < |num_split_frames_| - int16_t* const* split_bands(int channel); - const int16_t* const* split_bands_const(int channel) const; - float* const* split_bands_f(int channel); - const float* const* split_bands_const_f(int channel) const; + int16_t* const* split_bands(size_t channel); + const int16_t* const* split_bands_const(size_t channel) const; + float* const* split_bands_f(size_t channel); + const float* const* split_bands_const_f(size_t channel) const; // Returns a pointer array to the channels for a specific band. // Usage: @@ -128,16 +128,16 @@ class AudioBuffer { // The audio is passed into DeinterleaveFrom() or CopyFrom() with input // format (samples per channel and number of channels). const size_t input_num_frames_; - const int num_input_channels_; + const size_t num_input_channels_; // The audio is stored by DeinterleaveFrom() or CopyFrom() with processing // format. const size_t proc_num_frames_; - const int num_proc_channels_; + const size_t num_proc_channels_; // The audio is returned by InterleaveTo() and CopyTo() with output samples // per channels and the current number of channels. This last one can be // changed at any time using set_num_channels(). const size_t output_num_frames_; - int num_channels_; + size_t num_channels_; size_t num_bands_; size_t num_split_frames_; diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index fea57856df..744309c774 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -410,16 +410,13 @@ int AudioProcessingImpl::InitializeLocked() { int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) { for (const auto& stream : config.streams) { - if (stream.num_channels() < 0) { - return kBadNumberChannelsError; - } if (stream.num_channels() > 0 && stream.sample_rate_hz() <= 0) { return kBadSampleRateError; } } - const int num_in_channels = config.input_stream().num_channels(); - const int num_out_channels = config.output_stream().num_channels(); + const size_t num_in_channels = config.input_stream().num_channels(); + const size_t num_out_channels = config.output_stream().num_channels(); // Need at least one input channel. // Need either one output channel or as many outputs as there are inputs. @@ -429,7 +426,7 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) { } if (capture_nonlocked_.beamformer_enabled && - static_cast<size_t>(num_in_channels) != capture_.array_geometry.size()) { + num_in_channels != capture_.array_geometry.size()) { return kBadNumberChannelsError; } @@ -527,22 +524,22 @@ int AudioProcessingImpl::proc_split_sample_rate_hz() const { return capture_nonlocked_.split_rate; } -int AudioProcessingImpl::num_reverse_channels() const { +size_t AudioProcessingImpl::num_reverse_channels() const { // Used as callback from submodules, hence locking is not allowed. return formats_.rev_proc_format.num_channels(); } -int AudioProcessingImpl::num_input_channels() const { +size_t AudioProcessingImpl::num_input_channels() const { // Used as callback from submodules, hence locking is not allowed. return formats_.api_format.input_stream().num_channels(); } -int AudioProcessingImpl::num_proc_channels() const { +size_t AudioProcessingImpl::num_proc_channels() const { // Used as callback from submodules, hence locking is not allowed. return capture_nonlocked_.beamformer_enabled ? 1 : num_output_channels(); } -int AudioProcessingImpl::num_output_channels() const { +size_t AudioProcessingImpl::num_output_channels() const { // Used as callback from submodules, hence locking is not allowed. return formats_.api_format.output_stream().num_channels(); } @@ -631,7 +628,8 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); const size_t channel_size = sizeof(float) * formats_.api_format.input_stream().num_frames(); - for (int i = 0; i < formats_.api_format.input_stream().num_channels(); ++i) + for (size_t i = 0; i < formats_.api_format.input_stream().num_channels(); + ++i) msg->add_input_channel(src[i], channel_size); } #endif @@ -645,7 +643,8 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); const size_t channel_size = sizeof(float) * formats_.api_format.output_stream().num_frames(); - for (int i = 0; i < formats_.api_format.output_stream().num_channels(); ++i) + for (size_t i = 0; i < formats_.api_format.output_stream().num_channels(); + ++i) msg->add_output_channel(dest[i], channel_size); RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), &crit_debug_, &debug_dump_.capture)); @@ -879,7 +878,7 @@ int AudioProcessingImpl::AnalyzeReverseStreamLocked( return kNullPointerError; } - if (reverse_input_config.num_channels() <= 0) { + if (reverse_input_config.num_channels() == 0) { return kBadNumberChannelsError; } @@ -898,7 +897,7 @@ int AudioProcessingImpl::AnalyzeReverseStreamLocked( debug_dump_.render.event_msg->mutable_reverse_stream(); const size_t channel_size = sizeof(float) * formats_.api_format.reverse_input_stream().num_frames(); - for (int i = 0; + for (size_t i = 0; i < formats_.api_format.reverse_input_stream().num_channels(); ++i) msg->add_channel(src[i], channel_size); RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), @@ -1455,12 +1454,12 @@ int AudioProcessingImpl::WriteInitMessage() { audioproc::Init* msg = debug_dump_.capture.event_msg->mutable_init(); msg->set_sample_rate(formats_.api_format.input_stream().sample_rate_hz()); - msg->set_num_input_channels( - formats_.api_format.input_stream().num_channels()); - msg->set_num_output_channels( - formats_.api_format.output_stream().num_channels()); - msg->set_num_reverse_channels( - formats_.api_format.reverse_input_stream().num_channels()); + msg->set_num_input_channels(static_cast<google::protobuf::int32>( + formats_.api_format.input_stream().num_channels())); + msg->set_num_output_channels(static_cast<google::protobuf::int32>( + formats_.api_format.output_stream().num_channels())); + msg->set_num_reverse_channels(static_cast<google::protobuf::int32>( + formats_.api_format.reverse_input_stream().num_channels())); msg->set_reverse_sample_rate( formats_.api_format.reverse_input_stream().sample_rate_hz()); msg->set_output_sample_rate( diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h index 6cb9e8cadc..b310896903 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.h +++ b/webrtc/modules/audio_processing/audio_processing_impl.h @@ -101,10 +101,10 @@ class AudioProcessingImpl : public AudioProcessing { // Hence there is no need for locks in these. int proc_sample_rate_hz() const override; int proc_split_sample_rate_hz() const override; - int num_input_channels() const override; - int num_proc_channels() const override; - int num_output_channels() const override; - int num_reverse_channels() const override; + size_t num_input_channels() const override; + size_t num_proc_channels() const override; + size_t num_output_channels() const override; + size_t num_reverse_channels() const override; int stream_delay_ms() const override; bool was_stream_delay_set() const override EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); diff --git a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc index 7e96774466..e1e6a310a5 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc @@ -477,7 +477,7 @@ void PopulateAudioFrame(AudioFrame* frame, RandomGenerator* rand_gen) { ASSERT_GT(amplitude, 0); ASSERT_LE(amplitude, 32767); - for (int ch = 0; ch < frame->num_channels_; ch++) { + for (size_t ch = 0; ch < frame->num_channels_; ch++) { for (size_t k = 0; k < frame->samples_per_channel_; k++) { // Store random 16 bit number between -(amplitude+1) and // amplitude. diff --git a/webrtc/modules/audio_processing/beamformer/complex_matrix.h b/webrtc/modules/audio_processing/beamformer/complex_matrix.h index bfa3563b89..707c51564b 100644 --- a/webrtc/modules/audio_processing/beamformer/complex_matrix.h +++ b/webrtc/modules/audio_processing/beamformer/complex_matrix.h @@ -27,10 +27,10 @@ class ComplexMatrix : public Matrix<complex<T> > { public: ComplexMatrix() : Matrix<complex<T> >() {} - ComplexMatrix(int num_rows, int num_columns) + ComplexMatrix(size_t num_rows, size_t num_columns) : Matrix<complex<T> >(num_rows, num_columns) {} - ComplexMatrix(const complex<T>* data, int num_rows, int num_columns) + ComplexMatrix(const complex<T>* data, size_t num_rows, size_t num_columns) : Matrix<complex<T> >(data, num_rows, num_columns) {} // Complex Matrix operations. @@ -51,7 +51,7 @@ class ComplexMatrix : public Matrix<complex<T> > { ComplexMatrix& ConjugateTranspose() { this->CopyDataToScratch(); - int num_rows = this->num_rows(); + size_t num_rows = this->num_rows(); this->SetNumRows(this->num_columns()); this->SetNumColumns(num_rows); this->Resize(); @@ -82,8 +82,8 @@ class ComplexMatrix : public Matrix<complex<T> > { private: ComplexMatrix& ConjugateTranspose(const complex<T>* const* src) { complex<T>* const* elements = this->elements(); - for (int i = 0; i < this->num_rows(); ++i) { - for (int j = 0; j < this->num_columns(); ++j) { + for (size_t i = 0; i < this->num_rows(); ++i) { + for (size_t j = 0; j < this->num_columns(); ++j) { elements[i][j] = conj(src[j][i]); } } diff --git a/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc b/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc index d0728325fc..78f4df5ca9 100644 --- a/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc +++ b/webrtc/modules/audio_processing/beamformer/covariance_matrix_generator.cc @@ -27,7 +27,7 @@ float BesselJ0(float x) { // Calculates the Euclidean norm for a row vector. float Norm(const ComplexMatrix<float>& x) { - RTC_CHECK_EQ(1, x.num_rows()); + RTC_CHECK_EQ(1u, x.num_rows()); const size_t length = x.num_columns(); const complex<float>* elems = x.elements()[0]; float result = 0.f; @@ -43,8 +43,8 @@ void CovarianceMatrixGenerator::UniformCovarianceMatrix( float wave_number, const std::vector<Point>& geometry, ComplexMatrix<float>* mat) { - RTC_CHECK_EQ(static_cast<int>(geometry.size()), mat->num_rows()); - RTC_CHECK_EQ(static_cast<int>(geometry.size()), mat->num_columns()); + RTC_CHECK_EQ(geometry.size(), mat->num_rows()); + RTC_CHECK_EQ(geometry.size(), mat->num_columns()); complex<float>* const* mat_els = mat->elements(); for (size_t i = 0; i < geometry.size(); ++i) { @@ -68,8 +68,8 @@ void CovarianceMatrixGenerator::AngledCovarianceMatrix( int sample_rate, const std::vector<Point>& geometry, ComplexMatrix<float>* mat) { - RTC_CHECK_EQ(static_cast<int>(geometry.size()), mat->num_rows()); - RTC_CHECK_EQ(static_cast<int>(geometry.size()), mat->num_columns()); + RTC_CHECK_EQ(geometry.size(), mat->num_rows()); + RTC_CHECK_EQ(geometry.size(), mat->num_columns()); ComplexMatrix<float> interf_cov_vector(1, geometry.size()); ComplexMatrix<float> interf_cov_vector_transposed(geometry.size(), 1); @@ -94,8 +94,8 @@ void CovarianceMatrixGenerator::PhaseAlignmentMasks( const std::vector<Point>& geometry, float angle, ComplexMatrix<float>* mat) { - RTC_CHECK_EQ(1, mat->num_rows()); - RTC_CHECK_EQ(static_cast<int>(geometry.size()), mat->num_columns()); + RTC_CHECK_EQ(1u, mat->num_rows()); + RTC_CHECK_EQ(geometry.size(), mat->num_columns()); float freq_in_hertz = (static_cast<float>(frequency_bin) / fft_size) * sample_rate; diff --git a/webrtc/modules/audio_processing/beamformer/matrix.h b/webrtc/modules/audio_processing/beamformer/matrix.h index 162aef1dac..51c1cece97 100644 --- a/webrtc/modules/audio_processing/beamformer/matrix.h +++ b/webrtc/modules/audio_processing/beamformer/matrix.h @@ -67,7 +67,7 @@ class Matrix { Matrix() : num_rows_(0), num_columns_(0) {} // Allocates space for the elements and initializes all values to zero. - Matrix(int num_rows, int num_columns) + Matrix(size_t num_rows, size_t num_columns) : num_rows_(num_rows), num_columns_(num_columns) { Resize(); scratch_data_.resize(num_rows_ * num_columns_); @@ -75,7 +75,7 @@ class Matrix { } // Copies |data| into the new Matrix. - Matrix(const T* data, int num_rows, int num_columns) + Matrix(const T* data, size_t num_rows, size_t num_columns) : num_rows_(0), num_columns_(0) { CopyFrom(data, num_rows, num_columns); scratch_data_.resize(num_rows_ * num_columns_); @@ -90,23 +90,23 @@ class Matrix { } // Copy |data| into the Matrix. The current data is lost. - void CopyFrom(const T* const data, int num_rows, int num_columns) { + void CopyFrom(const T* const data, size_t num_rows, size_t num_columns) { Resize(num_rows, num_columns); memcpy(&data_[0], data, num_rows_ * num_columns_ * sizeof(data_[0])); } Matrix& CopyFromColumn(const T* const* src, size_t column_index, - int num_rows) { + size_t num_rows) { Resize(1, num_rows); - for (int i = 0; i < num_columns_; ++i) { + for (size_t i = 0; i < num_columns_; ++i) { data_[i] = src[i][column_index]; } return *this; } - void Resize(int num_rows, int num_columns) { + void Resize(size_t num_rows, size_t num_columns) { if (num_rows != num_rows_ || num_columns != num_columns_) { num_rows_ = num_rows; num_columns_ = num_columns; @@ -115,8 +115,8 @@ class Matrix { } // Accessors and mutators. - int num_rows() const { return num_rows_; } - int num_columns() const { return num_columns_; } + size_t num_rows() const { return num_rows_; } + size_t num_columns() const { return num_columns_; } T* const* elements() { return &elements_[0]; } const T* const* elements() const { return &elements_[0]; } @@ -124,7 +124,7 @@ class Matrix { RTC_CHECK_EQ(num_rows_, num_columns_); T trace = 0; - for (int i = 0; i < num_rows_; ++i) { + for (size_t i = 0; i < num_rows_; ++i) { trace += elements_[i][i]; } return trace; @@ -282,8 +282,8 @@ class Matrix { std::ostringstream ss; ss << std::endl << "Matrix" << std::endl; - for (int i = 0; i < num_rows_; ++i) { - for (int j = 0; j < num_columns_; ++j) { + for (size_t i = 0; i < num_rows_; ++i) { + for (size_t j = 0; j < num_columns_; ++j) { ss << elements_[i][j] << " "; } ss << std::endl; @@ -294,8 +294,8 @@ class Matrix { } protected: - void SetNumRows(const int num_rows) { num_rows_ = num_rows; } - void SetNumColumns(const int num_columns) { num_columns_ = num_columns; } + void SetNumRows(const size_t num_rows) { num_rows_ = num_rows; } + void SetNumColumns(const size_t num_columns) { num_columns_ = num_columns; } T* data() { return &data_[0]; } const T* data() const { return &data_[0]; } const T* const* scratch_elements() const { return &scratch_elements_[0]; } @@ -307,7 +307,7 @@ class Matrix { data_.resize(size); elements_.resize(num_rows_); - for (int i = 0; i < num_rows_; ++i) { + for (size_t i = 0; i < num_rows_; ++i) { elements_[i] = &data_[i * num_columns_]; } } @@ -317,14 +317,14 @@ class Matrix { scratch_data_ = data_; scratch_elements_.resize(num_rows_); - for (int i = 0; i < num_rows_; ++i) { + for (size_t i = 0; i < num_rows_; ++i) { scratch_elements_[i] = &scratch_data_[i * num_columns_]; } } private: - int num_rows_; - int num_columns_; + size_t num_rows_; + size_t num_columns_; std::vector<T> data_; std::vector<T*> elements_; @@ -336,8 +336,8 @@ class Matrix { // Helpers for Transpose and Multiply operations that unify in-place and // out-of-place solutions. Matrix& Transpose(const T* const* src) { - for (int i = 0; i < num_rows_; ++i) { - for (int j = 0; j < num_columns_; ++j) { + for (size_t i = 0; i < num_rows_; ++i) { + for (size_t j = 0; j < num_columns_; ++j) { elements_[i][j] = src[j][i]; } } @@ -345,11 +345,13 @@ class Matrix { return *this; } - Matrix& Multiply(const T* const* lhs, int num_rows_rhs, const T* const* rhs) { - for (int row = 0; row < num_rows_; ++row) { - for (int col = 0; col < num_columns_; ++col) { + Matrix& Multiply(const T* const* lhs, + size_t num_rows_rhs, + const T* const* rhs) { + for (size_t row = 0; row < num_rows_; ++row) { + for (size_t col = 0; col < num_columns_; ++col) { T cur_element = 0; - for (int i = 0; i < num_rows_rhs; ++i) { + for (size_t i = 0; i < num_rows_rhs; ++i) { cur_element += lhs[row][i] * rhs[i][col]; } diff --git a/webrtc/modules/audio_processing/beamformer/matrix_test_helpers.h b/webrtc/modules/audio_processing/beamformer/matrix_test_helpers.h index 7c58670068..9891a8220c 100644 --- a/webrtc/modules/audio_processing/beamformer/matrix_test_helpers.h +++ b/webrtc/modules/audio_processing/beamformer/matrix_test_helpers.h @@ -34,8 +34,8 @@ class MatrixTestHelpers { const T* const* expected_elements = expected.elements(); const T* const* actual_elements = actual.elements(); - for (int i = 0; i < expected.num_rows(); ++i) { - for (int j = 0; j < expected.num_columns(); ++j) { + for (size_t i = 0; i < expected.num_rows(); ++i) { + for (size_t j = 0; j < expected.num_columns(); ++j) { EXPECT_EQ(expected_elements[i][j], actual_elements[i][j]); } } @@ -48,8 +48,8 @@ class MatrixTestHelpers { const float* const* expected_elements = expected.elements(); const float* const* actual_elements = actual.elements(); - for (int i = 0; i < expected.num_rows(); ++i) { - for (int j = 0; j < expected.num_columns(); ++j) { + for (size_t i = 0; i < expected.num_rows(); ++i) { + for (size_t j = 0; j < expected.num_columns(); ++j) { EXPECT_NEAR(expected_elements[i][j], actual_elements[i][j], kTolerance); } } @@ -63,8 +63,8 @@ class MatrixTestHelpers { const complex<float>* const* expected_elements = expected.elements(); const complex<float>* const* actual_elements = actual.elements(); - for (int i = 0; i < expected.num_rows(); ++i) { - for (int j = 0; j < expected.num_columns(); ++j) { + for (size_t i = 0; i < expected.num_rows(); ++i) { + for (size_t j = 0; j < expected.num_columns(); ++j) { EXPECT_NEAR(expected_elements[i][j].real(), actual_elements[i][j].real(), kTolerance); @@ -84,8 +84,8 @@ class MatrixTestHelpers { const complex<float>* const* expected_elements = expected.elements(); const complex<float>* const* actual_elements = actual.elements(); - for (int i = 0; i < expected.num_rows(); ++i) { - for (int j = 0; j < expected.num_columns(); ++j) { + for (size_t i = 0; i < expected.num_rows(); ++i) { + for (size_t j = 0; j < expected.num_columns(); ++j) { EXPECT_NEAR(expected_elements[i][j].real(), actual_elements[i][j].real(), tolerance); diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc index 0544104b79..6ea7234f6f 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc @@ -79,7 +79,7 @@ const float kCompensationGain = 2.f; // The returned norm is clamped to be non-negative. float Norm(const ComplexMatrix<float>& mat, const ComplexMatrix<float>& norm_mat) { - RTC_CHECK_EQ(norm_mat.num_rows(), 1); + RTC_CHECK_EQ(1u, norm_mat.num_rows()); RTC_CHECK_EQ(norm_mat.num_columns(), mat.num_rows()); RTC_CHECK_EQ(norm_mat.num_columns(), mat.num_columns()); @@ -89,8 +89,8 @@ float Norm(const ComplexMatrix<float>& mat, const complex<float>* const* mat_els = mat.elements(); const complex<float>* const* norm_mat_els = norm_mat.elements(); - for (int i = 0; i < norm_mat.num_columns(); ++i) { - for (int j = 0; j < norm_mat.num_columns(); ++j) { + for (size_t i = 0; i < norm_mat.num_columns(); ++i) { + for (size_t j = 0; j < norm_mat.num_columns(); ++j) { first_product += conj(norm_mat_els[0][j]) * mat_els[j][i]; } second_product += first_product * norm_mat_els[0][i]; @@ -102,15 +102,15 @@ float Norm(const ComplexMatrix<float>& mat, // Does conjugate(|lhs|) * |rhs| for row vectors |lhs| and |rhs|. complex<float> ConjugateDotProduct(const ComplexMatrix<float>& lhs, const ComplexMatrix<float>& rhs) { - RTC_CHECK_EQ(lhs.num_rows(), 1); - RTC_CHECK_EQ(rhs.num_rows(), 1); + RTC_CHECK_EQ(1u, lhs.num_rows()); + RTC_CHECK_EQ(1u, rhs.num_rows()); RTC_CHECK_EQ(lhs.num_columns(), rhs.num_columns()); const complex<float>* const* lhs_elements = lhs.elements(); const complex<float>* const* rhs_elements = rhs.elements(); complex<float> result = complex<float>(0.f, 0.f); - for (int i = 0; i < lhs.num_columns(); ++i) { + for (size_t i = 0; i < lhs.num_columns(); ++i) { result += conj(lhs_elements[0][i]) * rhs_elements[0][i]; } @@ -126,8 +126,8 @@ size_t Round(float x) { float SumAbs(const ComplexMatrix<float>& mat) { float sum_abs = 0.f; const complex<float>* const* mat_els = mat.elements(); - for (int i = 0; i < mat.num_rows(); ++i) { - for (int j = 0; j < mat.num_columns(); ++j) { + for (size_t i = 0; i < mat.num_rows(); ++i) { + for (size_t j = 0; j < mat.num_columns(); ++j) { sum_abs += std::abs(mat_els[i][j]); } } @@ -138,8 +138,8 @@ float SumAbs(const ComplexMatrix<float>& mat) { float SumSquares(const ComplexMatrix<float>& mat) { float sum_squares = 0.f; const complex<float>* const* mat_els = mat.elements(); - for (int i = 0; i < mat.num_rows(); ++i) { - for (int j = 0; j < mat.num_columns(); ++j) { + for (size_t i = 0; i < mat.num_rows(); ++i) { + for (size_t j = 0; j < mat.num_columns(); ++j) { float abs_value = std::abs(mat_els[i][j]); sum_squares += abs_value * abs_value; } @@ -150,13 +150,13 @@ float SumSquares(const ComplexMatrix<float>& mat) { // Does |out| = |in|.' * conj(|in|) for row vector |in|. void TransposedConjugatedProduct(const ComplexMatrix<float>& in, ComplexMatrix<float>* out) { - RTC_CHECK_EQ(in.num_rows(), 1); + RTC_CHECK_EQ(1u, in.num_rows()); RTC_CHECK_EQ(out->num_rows(), in.num_columns()); RTC_CHECK_EQ(out->num_columns(), in.num_columns()); const complex<float>* in_elements = in.elements()[0]; complex<float>* const* out_elements = out->elements(); - for (int i = 0; i < out->num_rows(); ++i) { - for (int j = 0; j < out->num_columns(); ++j) { + for (size_t i = 0; i < out->num_rows(); ++i) { + for (size_t j = 0; j < out->num_columns(); ++j) { out_elements[i][j] = in_elements[i] * conj(in_elements[j]); } } @@ -408,13 +408,13 @@ bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) { } void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input, - int num_input_channels, + size_t num_input_channels, size_t num_freq_bins, - int num_output_channels, + size_t num_output_channels, complex_f* const* output) { RTC_CHECK_EQ(kNumFreqBins, num_freq_bins); RTC_CHECK_EQ(num_input_channels_, num_input_channels); - RTC_CHECK_EQ(1, num_output_channels); + RTC_CHECK_EQ(1u, num_output_channels); // Calculating the post-filter masks. Note that we need two for each // frequency bin to account for the positive and negative interferer @@ -483,7 +483,7 @@ void NonlinearBeamformer::ApplyMasks(const complex_f* const* input, const complex_f* delay_sum_mask_els = normalized_delay_sum_masks_[f_ix].elements()[0]; - for (int c_ix = 0; c_ix < num_input_channels_; ++c_ix) { + for (size_t c_ix = 0; c_ix < num_input_channels_; ++c_ix) { output_channel[f_ix] += input[c_ix][f_ix] * delay_sum_mask_els[c_ix]; } diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h index b20d9389b7..29c416ca91 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h @@ -67,9 +67,9 @@ class NonlinearBeamformer // Process one frequency-domain block of audio. This is where the fun // happens. Implements LappedTransform::Callback. void ProcessAudioBlock(const complex<float>* const* input, - int num_input_channels, + size_t num_input_channels, size_t num_freq_bins, - int num_output_channels, + size_t num_output_channels, complex<float>* const* output) override; private: @@ -129,7 +129,7 @@ class NonlinearBeamformer float window_[kFftSize]; // Parameters exposed to the user. - const int num_input_channels_; + const size_t num_input_channels_; int sample_rate_hz_; const std::vector<Point> array_geometry_; diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc index cc752485e9..d187552692 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_test.cc @@ -12,6 +12,7 @@ #include "gflags/gflags.h" #include "webrtc/base/checks.h" +#include "webrtc/base/format_macros.h" #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/common_audio/wav_file.h" #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" @@ -52,9 +53,9 @@ int main(int argc, char* argv[]) { NonlinearBeamformer bf(array_geometry); bf.Initialize(kChunkSizeMs, in_file.sample_rate()); - printf("Input file: %s\nChannels: %d, Sample rate: %d Hz\n\n", + printf("Input file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n", FLAGS_i.c_str(), in_file.num_channels(), in_file.sample_rate()); - printf("Output file: %s\nChannels: %d, Sample rate: %d Hz\n\n", + printf("Output file: %s\nChannels: %" PRIuS ", Sample rate: %d Hz\n\n", FLAGS_o.c_str(), out_file.num_channels(), out_file.sample_rate()); ChannelBuffer<float> in_buf( diff --git a/webrtc/modules/audio_processing/common.h b/webrtc/modules/audio_processing/common.h index cf0d8b772f..d4ddb92b50 100644 --- a/webrtc/modules/audio_processing/common.h +++ b/webrtc/modules/audio_processing/common.h @@ -17,7 +17,7 @@ namespace webrtc { -static inline int ChannelsFromLayout(AudioProcessing::ChannelLayout layout) { +static inline size_t ChannelsFromLayout(AudioProcessing::ChannelLayout layout) { switch (layout) { case AudioProcessing::kMono: case AudioProcessing::kMonoAndKeyboard: diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc index 13e71bc352..debc597c54 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc @@ -99,8 +99,8 @@ int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { // The ordering convention must be followed to pass to the correct AEC. size_t handle_index = 0; render_queue_buffer_.clear(); - for (int i = 0; i < apm_->num_output_channels(); i++) { - for (int j = 0; j < audio->num_channels(); j++) { + for (size_t i = 0; i < apm_->num_output_channels(); i++) { + for (size_t j = 0; j < audio->num_channels(); j++) { Handle* my_handle = static_cast<Handle*>(handle(handle_index)); // Retrieve any error code produced by the buffering of the farend // signal @@ -146,8 +146,8 @@ void EchoCancellationImpl::ReadQueuedRenderData() { const size_t num_frames_per_band = capture_queue_buffer_.size() / (apm_->num_output_channels() * apm_->num_reverse_channels()); - for (int i = 0; i < apm_->num_output_channels(); i++) { - for (int j = 0; j < apm_->num_reverse_channels(); j++) { + for (size_t i = 0; i < apm_->num_output_channels(); i++) { + for (size_t j = 0; j < apm_->num_reverse_channels(); j++) { Handle* my_handle = static_cast<Handle*>(handle(handle_index)); WebRtcAec_BufferFarend(my_handle, &capture_queue_buffer_[buffer_index], num_frames_per_band); @@ -181,8 +181,8 @@ int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio) { // The ordering convention must be followed to pass to the correct AEC. size_t handle_index = 0; stream_has_echo_ = false; - for (int i = 0; i < audio->num_channels(); i++) { - for (int j = 0; j < apm_->num_reverse_channels(); j++) { + for (size_t i = 0; i < audio->num_channels(); i++) { + for (size_t j = 0; j < apm_->num_reverse_channels(); j++) { Handle* my_handle = handle(handle_index); err = WebRtcAec_Process(my_handle, audio->split_bands_const_f(i), audio->num_bands(), audio->split_bands_f(i), @@ -489,7 +489,7 @@ int EchoCancellationImpl::ConfigureHandle(void* handle) const { return WebRtcAec_set_config(static_cast<Handle*>(handle), config); } -int EchoCancellationImpl::num_handles_required() const { +size_t EchoCancellationImpl::num_handles_required() const { // Not locked as it only relies on APM public API which is threadsafe. return apm_->num_output_channels() * apm_->num_reverse_channels(); } diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.h b/webrtc/modules/audio_processing/echo_cancellation_impl.h index 9418fbfed7..a40a267e32 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.h +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.h @@ -72,7 +72,7 @@ class EchoCancellationImpl : public EchoCancellation, int InitializeHandle(void* handle) const override; int ConfigureHandle(void* handle) const override; void DestroyHandle(void* handle) const override; - int num_handles_required() const override; + size_t num_handles_required() const override; int GetHandleError(void* handle) const override; void AllocateRenderQueue(); diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc index a39528efd3..f2df5f7984 100644 --- a/webrtc/modules/audio_processing/echo_control_mobile_impl.cc +++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.cc @@ -104,8 +104,8 @@ int EchoControlMobileImpl::ProcessRenderAudio(const AudioBuffer* audio) { // The ordering convention must be followed to pass to the correct AECM. size_t handle_index = 0; render_queue_buffer_.clear(); - for (int i = 0; i < apm_->num_output_channels(); i++) { - for (int j = 0; j < audio->num_channels(); j++) { + for (size_t i = 0; i < apm_->num_output_channels(); i++) { + for (size_t j = 0; j < audio->num_channels(); j++) { Handle* my_handle = static_cast<Handle*>(handle(handle_index)); err = WebRtcAecm_GetBufferFarendError( my_handle, audio->split_bands_const(j)[kBand0To8kHz], @@ -151,8 +151,8 @@ void EchoControlMobileImpl::ReadQueuedRenderData() { const size_t num_frames_per_band = capture_queue_buffer_.size() / (apm_->num_output_channels() * apm_->num_reverse_channels()); - for (int i = 0; i < apm_->num_output_channels(); i++) { - for (int j = 0; j < apm_->num_reverse_channels(); j++) { + for (size_t i = 0; i < apm_->num_output_channels(); i++) { + for (size_t j = 0; j < apm_->num_reverse_channels(); j++) { Handle* my_handle = static_cast<Handle*>(handle(handle_index)); WebRtcAecm_BufferFarend(my_handle, &capture_queue_buffer_[buffer_index], num_frames_per_band); @@ -182,7 +182,7 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio) { // The ordering convention must be followed to pass to the correct AECM. size_t handle_index = 0; - for (int i = 0; i < audio->num_channels(); i++) { + for (size_t i = 0; i < audio->num_channels(); i++) { // TODO(ajm): improve how this works, possibly inside AECM. // This is kind of hacked up. const int16_t* noisy = audio->low_pass_reference(i); @@ -191,7 +191,7 @@ int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio) { noisy = clean; clean = NULL; } - for (int j = 0; j < apm_->num_reverse_channels(); j++) { + for (size_t j = 0; j < apm_->num_reverse_channels(); j++) { Handle* my_handle = static_cast<Handle*>(handle(handle_index)); err = WebRtcAecm_Process( my_handle, @@ -394,7 +394,7 @@ int EchoControlMobileImpl::ConfigureHandle(void* handle) const { return WebRtcAecm_set_config(static_cast<Handle*>(handle), config); } -int EchoControlMobileImpl::num_handles_required() const { +size_t EchoControlMobileImpl::num_handles_required() const { // Not locked as it only relies on APM public API which is threadsafe. return apm_->num_output_channels() * apm_->num_reverse_channels(); } diff --git a/webrtc/modules/audio_processing/echo_control_mobile_impl.h b/webrtc/modules/audio_processing/echo_control_mobile_impl.h index 3b5dbf3be1..4d6529d3ac 100644 --- a/webrtc/modules/audio_processing/echo_control_mobile_impl.h +++ b/webrtc/modules/audio_processing/echo_control_mobile_impl.h @@ -58,7 +58,7 @@ class EchoControlMobileImpl : public EchoControlMobile, int InitializeHandle(void* handle) const override; int ConfigureHandle(void* handle) const override; void DestroyHandle(void* handle) const override; - int num_handles_required() const override; + size_t num_handles_required() const override; int GetHandleError(void* handle) const override; void AllocateRenderQueue(); diff --git a/webrtc/modules/audio_processing/gain_control_impl.cc b/webrtc/modules/audio_processing/gain_control_impl.cc index 7b284e8853..04a6c7ba29 100644 --- a/webrtc/modules/audio_processing/gain_control_impl.cc +++ b/webrtc/modules/audio_processing/gain_control_impl.cc @@ -75,7 +75,7 @@ int GainControlImpl::ProcessRenderAudio(AudioBuffer* audio) { assert(audio->num_frames_per_band() <= 160); render_queue_buffer_.resize(0); - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { Handle* my_handle = static_cast<Handle*>(handle(i)); int err = WebRtcAgc_GetAddFarendError(my_handle, audio->num_frames_per_band()); @@ -114,7 +114,7 @@ void GainControlImpl::ReadQueuedRenderData() { size_t buffer_index = 0; const size_t num_frames_per_band = capture_queue_buffer_.size() / num_handles(); - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { Handle* my_handle = static_cast<Handle*>(handle(i)); WebRtcAgc_AddFarend(my_handle, &capture_queue_buffer_[buffer_index], num_frames_per_band); @@ -138,7 +138,7 @@ int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) { if (mode_ == kAdaptiveAnalog) { capture_levels_.assign(num_handles(), analog_capture_level_); - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { Handle* my_handle = static_cast<Handle*>(handle(i)); err = WebRtcAgc_AddMic( my_handle, @@ -152,7 +152,7 @@ int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) { } } else if (mode_ == kAdaptiveDigital) { - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { Handle* my_handle = static_cast<Handle*>(handle(i)); int32_t capture_level_out = 0; @@ -191,7 +191,7 @@ int GainControlImpl::ProcessCaptureAudio(AudioBuffer* audio) { assert(audio->num_channels() == num_handles()); stream_is_saturated_ = false; - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { Handle* my_handle = static_cast<Handle*>(handle(i)); int32_t capture_level_out = 0; uint8_t saturation_warning = 0; @@ -222,7 +222,7 @@ int GainControlImpl::ProcessCaptureAudio(AudioBuffer* audio) { if (mode_ == kAdaptiveAnalog) { // Take the analog level to be the average across the handles. analog_capture_level_ = 0; - for (int i = 0; i < num_handles(); i++) { + for (size_t i = 0; i < num_handles(); i++) { analog_capture_level_ += capture_levels_[i]; } @@ -433,7 +433,7 @@ int GainControlImpl::ConfigureHandle(void* handle) const { return WebRtcAgc_set_config(static_cast<Handle*>(handle), config); } -int GainControlImpl::num_handles_required() const { +size_t GainControlImpl::num_handles_required() const { // Not locked as it only relies on APM public API which is threadsafe. return apm_->num_proc_channels(); } diff --git a/webrtc/modules/audio_processing/gain_control_impl.h b/webrtc/modules/audio_processing/gain_control_impl.h index b531de98bb..72789ba5e1 100644 --- a/webrtc/modules/audio_processing/gain_control_impl.h +++ b/webrtc/modules/audio_processing/gain_control_impl.h @@ -68,7 +68,7 @@ class GainControlImpl : public GainControl, int InitializeHandle(void* handle) const override; int ConfigureHandle(void* handle) const override; void DestroyHandle(void* handle) const override; - int num_handles_required() const override; + size_t num_handles_required() const override; int GetHandleError(void* handle) const override; void AllocateRenderQueue(); diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.cc b/webrtc/modules/audio_processing/high_pass_filter_impl.cc index facf1e4716..375d58febb 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.cc @@ -92,10 +92,9 @@ HighPassFilterImpl::HighPassFilterImpl(rtc::CriticalSection* crit) HighPassFilterImpl::~HighPassFilterImpl() {} -void HighPassFilterImpl::Initialize(int channels, int sample_rate_hz) { - RTC_DCHECK_LE(0, channels); +void HighPassFilterImpl::Initialize(size_t channels, int sample_rate_hz) { std::vector<rtc::scoped_ptr<BiquadFilter>> new_filters(channels); - for (int i = 0; i < channels; i++) { + for (size_t i = 0; i < channels; i++) { new_filters[i].reset(new BiquadFilter(sample_rate_hz)); } rtc::CritScope cs(crit_); @@ -110,7 +109,7 @@ void HighPassFilterImpl::ProcessCaptureAudio(AudioBuffer* audio) { } RTC_DCHECK_GE(160u, audio->num_frames_per_band()); - RTC_DCHECK_EQ(filters_.size(), static_cast<size_t>(audio->num_channels())); + RTC_DCHECK_EQ(filters_.size(), audio->num_channels()); for (size_t i = 0; i < filters_.size(); i++) { filters_[i]->Process(audio->split_bands(i)[kBand0To8kHz], audio->num_frames_per_band()); diff --git a/webrtc/modules/audio_processing/high_pass_filter_impl.h b/webrtc/modules/audio_processing/high_pass_filter_impl.h index d6e84fd280..0e985bac7a 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_impl.h +++ b/webrtc/modules/audio_processing/high_pass_filter_impl.h @@ -26,7 +26,7 @@ class HighPassFilterImpl : public HighPassFilter { ~HighPassFilterImpl() override; // TODO(peah): Fold into ctor, once public API is removed. - void Initialize(int channels, int sample_rate_hz); + void Initialize(size_t channels, int sample_rate_hz); void ProcessCaptureAudio(AudioBuffer* audio); // HighPassFilter implementation. diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index d39d27ef77..5dd63ebc30 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -287,10 +287,10 @@ class AudioProcessing { // necessary classes? virtual int proc_sample_rate_hz() const = 0; virtual int proc_split_sample_rate_hz() const = 0; - virtual int num_input_channels() const = 0; - virtual int num_proc_channels() const = 0; - virtual int num_output_channels() const = 0; - virtual int num_reverse_channels() const = 0; + virtual size_t num_input_channels() const = 0; + virtual size_t num_proc_channels() const = 0; + virtual size_t num_output_channels() const = 0; + virtual size_t num_reverse_channels() const = 0; // Set to true when the output of AudioProcessing will be muted or in some // other way not used. Ideally, the captured audio would still be processed, @@ -502,7 +502,7 @@ class StreamConfig { // is true, the last channel in any corresponding list of // channels is the keyboard channel. StreamConfig(int sample_rate_hz = 0, - int num_channels = 0, + size_t num_channels = 0, bool has_keyboard = false) : sample_rate_hz_(sample_rate_hz), num_channels_(num_channels), @@ -513,14 +513,14 @@ class StreamConfig { sample_rate_hz_ = value; num_frames_ = calculate_frames(value); } - void set_num_channels(int value) { num_channels_ = value; } + void set_num_channels(size_t value) { num_channels_ = value; } void set_has_keyboard(bool value) { has_keyboard_ = value; } int sample_rate_hz() const { return sample_rate_hz_; } // The number of channels in the stream, not including the keyboard channel if // present. - int num_channels() const { return num_channels_; } + size_t num_channels() const { return num_channels_; } bool has_keyboard() const { return has_keyboard_; } size_t num_frames() const { return num_frames_; } @@ -541,7 +541,7 @@ class StreamConfig { } int sample_rate_hz_; - int num_channels_; + size_t num_channels_; bool has_keyboard_; size_t num_frames_; }; diff --git a/webrtc/modules/audio_processing/include/mock_audio_processing.h b/webrtc/modules/audio_processing/include/mock_audio_processing.h index 4ff52baf1c..9e1f2d5861 100644 --- a/webrtc/modules/audio_processing/include/mock_audio_processing.h +++ b/webrtc/modules/audio_processing/include/mock_audio_processing.h @@ -201,11 +201,11 @@ class MockAudioProcessing : public AudioProcessing { MOCK_CONST_METHOD0(proc_split_sample_rate_hz, int()); MOCK_CONST_METHOD0(num_input_channels, - int()); + size_t()); MOCK_CONST_METHOD0(num_output_channels, - int()); + size_t()); MOCK_CONST_METHOD0(num_reverse_channels, - int()); + size_t()); MOCK_METHOD1(set_output_will_be_muted, void(bool muted)); MOCK_CONST_METHOD0(output_will_be_muted, diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc index d014ce060c..fe964aba8c 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc @@ -54,12 +54,12 @@ IntelligibilityEnhancer::TransformCallback::TransformCallback( void IntelligibilityEnhancer::TransformCallback::ProcessAudioBlock( const complex<float>* const* in_block, - int in_channels, + size_t in_channels, size_t frames, - int /* out_channels */, + size_t /* out_channels */, complex<float>* const* out_block) { RTC_DCHECK_EQ(parent_->freqs_, frames); - for (int i = 0; i < in_channels; ++i) { + for (size_t i = 0; i < in_channels; ++i) { parent_->DispatchAudio(source_, in_block[i], out_block[i]); } } @@ -129,7 +129,7 @@ IntelligibilityEnhancer::IntelligibilityEnhancer(const Config& config) void IntelligibilityEnhancer::ProcessRenderAudio(float* const* audio, int sample_rate_hz, - int num_channels) { + size_t num_channels) { RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); RTC_CHECK_EQ(num_render_channels_, num_channels); @@ -138,7 +138,7 @@ void IntelligibilityEnhancer::ProcessRenderAudio(float* const* audio, } if (active_) { - for (int i = 0; i < num_render_channels_; ++i) { + for (size_t i = 0; i < num_render_channels_; ++i) { memcpy(audio[i], temp_render_out_buffer_.channels()[i], chunk_length_ * sizeof(**audio)); } @@ -147,7 +147,7 @@ void IntelligibilityEnhancer::ProcessRenderAudio(float* const* audio, void IntelligibilityEnhancer::AnalyzeCaptureAudio(float* const* audio, int sample_rate_hz, - int num_channels) { + size_t num_channels) { RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); RTC_CHECK_EQ(num_capture_channels_, num_channels); diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h index 1e9e35ac2a..1eb22342ad 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h @@ -47,8 +47,8 @@ class IntelligibilityEnhancer { gain_change_limit(0.1f), rho(0.02f) {} int sample_rate_hz; - int num_capture_channels; - int num_render_channels; + size_t num_capture_channels; + size_t num_render_channels; intelligibility::VarianceArray::StepType var_type; float var_decay_rate; size_t var_window_size; @@ -63,12 +63,12 @@ class IntelligibilityEnhancer { // Reads and processes chunk of noise stream in time domain. void AnalyzeCaptureAudio(float* const* audio, int sample_rate_hz, - int num_channels); + size_t num_channels); // Reads chunk of speech in time domain and updates with modified signal. void ProcessRenderAudio(float* const* audio, int sample_rate_hz, - int num_channels); + size_t num_channels); bool active() const; private: @@ -85,9 +85,9 @@ class IntelligibilityEnhancer { // All in frequency domain, receives input |in_block|, applies // intelligibility enhancement, and writes result to |out_block|. void ProcessAudioBlock(const std::complex<float>* const* in_block, - int in_channels, + size_t in_channels, size_t frames, - int out_channels, + size_t out_channels, std::complex<float>* const* out_block) override; private: @@ -144,8 +144,8 @@ class IntelligibilityEnhancer { const size_t bank_size_; // Num ERB filters. const int sample_rate_hz_; const int erb_resolution_; - const int num_capture_channels_; - const int num_render_channels_; + const size_t num_capture_channels_; + const size_t num_render_channels_; const int analysis_rate_; // Num blocks before gains recalculated. const bool active_; // Whether render gains are being updated. diff --git a/webrtc/modules/audio_processing/intelligibility/test/intelligibility_proc.cc b/webrtc/modules/audio_processing/intelligibility/test/intelligibility_proc.cc index 27d0ab48bb..4d2f5f4c5d 100644 --- a/webrtc/modules/audio_processing/intelligibility/test/intelligibility_proc.cc +++ b/webrtc/modules/audio_processing/intelligibility/test/intelligibility_proc.cc @@ -68,7 +68,7 @@ DEFINE_string(out_file, "Enhanced output. Use '-' to " "play through aplay immediately."); -const int kNumChannels = 1; +const size_t kNumChannels = 1; // void function for gtest void void_main(int argc, char* argv[]) { diff --git a/webrtc/modules/audio_processing/level_estimator_impl.cc b/webrtc/modules/audio_processing/level_estimator_impl.cc index aa676a870f..187873e33e 100644 --- a/webrtc/modules/audio_processing/level_estimator_impl.cc +++ b/webrtc/modules/audio_processing/level_estimator_impl.cc @@ -35,7 +35,7 @@ void LevelEstimatorImpl::ProcessStream(AudioBuffer* audio) { return; } - for (int i = 0; i < audio->num_channels(); i++) { + for (size_t i = 0; i < audio->num_channels(); i++) { rms_->Process(audio->channels_const()[i], audio->num_frames()); } } diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.cc b/webrtc/modules/audio_processing/noise_suppression_impl.cc index a40cd631b6..de7e856676 100644 --- a/webrtc/modules/audio_processing/noise_suppression_impl.cc +++ b/webrtc/modules/audio_processing/noise_suppression_impl.cc @@ -52,15 +52,14 @@ NoiseSuppressionImpl::NoiseSuppressionImpl(rtc::CriticalSection* crit) NoiseSuppressionImpl::~NoiseSuppressionImpl() {} -void NoiseSuppressionImpl::Initialize(int channels, int sample_rate_hz) { - RTC_DCHECK_LE(0, channels); +void NoiseSuppressionImpl::Initialize(size_t channels, int sample_rate_hz) { rtc::CritScope cs(crit_); channels_ = channels; sample_rate_hz_ = sample_rate_hz; std::vector<rtc::scoped_ptr<Suppressor>> new_suppressors; if (enabled_) { new_suppressors.resize(channels); - for (int i = 0; i < channels; i++) { + for (size_t i = 0; i < channels; i++) { new_suppressors[i].reset(new Suppressor(sample_rate_hz)); } } @@ -77,8 +76,7 @@ void NoiseSuppressionImpl::AnalyzeCaptureAudio(AudioBuffer* audio) { } RTC_DCHECK_GE(160u, audio->num_frames_per_band()); - RTC_DCHECK_EQ(suppressors_.size(), - static_cast<size_t>(audio->num_channels())); + RTC_DCHECK_EQ(suppressors_.size(), audio->num_channels()); for (size_t i = 0; i < suppressors_.size(); i++) { WebRtcNs_Analyze(suppressors_[i]->state(), audio->split_bands_const_f(i)[kBand0To8kHz]); @@ -94,8 +92,7 @@ void NoiseSuppressionImpl::ProcessCaptureAudio(AudioBuffer* audio) { } RTC_DCHECK_GE(160u, audio->num_frames_per_band()); - RTC_DCHECK_EQ(suppressors_.size(), - static_cast<size_t>(audio->num_channels())); + RTC_DCHECK_EQ(suppressors_.size(), audio->num_channels()); for (size_t i = 0; i < suppressors_.size(); i++) { #if defined(WEBRTC_NS_FLOAT) WebRtcNs_Process(suppressors_[i]->state(), diff --git a/webrtc/modules/audio_processing/noise_suppression_impl.h b/webrtc/modules/audio_processing/noise_suppression_impl.h index 491c4d2c32..debbc61bc9 100644 --- a/webrtc/modules/audio_processing/noise_suppression_impl.h +++ b/webrtc/modules/audio_processing/noise_suppression_impl.h @@ -26,7 +26,7 @@ class NoiseSuppressionImpl : public NoiseSuppression { ~NoiseSuppressionImpl() override; // TODO(peah): Fold into ctor, once public API is removed. - void Initialize(int channels, int sample_rate_hz); + void Initialize(size_t channels, int sample_rate_hz); void AnalyzeCaptureAudio(AudioBuffer* audio); void ProcessCaptureAudio(AudioBuffer* audio); @@ -42,7 +42,7 @@ class NoiseSuppressionImpl : public NoiseSuppression { rtc::CriticalSection* const crit_; bool enabled_ GUARDED_BY(crit_) = false; Level level_ GUARDED_BY(crit_) = kModerate; - int channels_ GUARDED_BY(crit_) = 0; + size_t channels_ GUARDED_BY(crit_) = 0; int sample_rate_hz_ GUARDED_BY(crit_) = 0; std::vector<rtc::scoped_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl); diff --git a/webrtc/modules/audio_processing/processing_component.cc b/webrtc/modules/audio_processing/processing_component.cc index 9e16d7c4ee..7abd8e2100 100644 --- a/webrtc/modules/audio_processing/processing_component.cc +++ b/webrtc/modules/audio_processing/processing_component.cc @@ -55,12 +55,12 @@ bool ProcessingComponent::is_component_enabled() const { return enabled_; } -void* ProcessingComponent::handle(int index) const { +void* ProcessingComponent::handle(size_t index) const { assert(index < num_handles_); return handles_[index]; } -int ProcessingComponent::num_handles() const { +size_t ProcessingComponent::num_handles() const { return num_handles_; } @@ -70,12 +70,12 @@ int ProcessingComponent::Initialize() { } num_handles_ = num_handles_required(); - if (num_handles_ > static_cast<int>(handles_.size())) { + if (num_handles_ > handles_.size()) { handles_.resize(num_handles_, NULL); } - assert(static_cast<int>(handles_.size()) >= num_handles_); - for (int i = 0; i < num_handles_; i++) { + assert(handles_.size() >= num_handles_); + for (size_t i = 0; i < num_handles_; i++) { if (handles_[i] == NULL) { handles_[i] = CreateHandle(); if (handles_[i] == NULL) { @@ -98,8 +98,8 @@ int ProcessingComponent::Configure() { return AudioProcessing::kNoError; } - assert(static_cast<int>(handles_.size()) >= num_handles_); - for (int i = 0; i < num_handles_; i++) { + assert(handles_.size() >= num_handles_); + for (size_t i = 0; i < num_handles_; i++) { int err = ConfigureHandle(handles_[i]); if (err != AudioProcessing::kNoError) { return GetHandleError(handles_[i]); diff --git a/webrtc/modules/audio_processing/processing_component.h b/webrtc/modules/audio_processing/processing_component.h index 291aea3922..577f1570ad 100644 --- a/webrtc/modules/audio_processing/processing_component.h +++ b/webrtc/modules/audio_processing/processing_component.h @@ -47,21 +47,21 @@ class ProcessingComponent { protected: virtual int Configure(); int EnableComponent(bool enable); - void* handle(int index) const; - int num_handles() const; + void* handle(size_t index) const; + size_t num_handles() const; private: virtual void* CreateHandle() const = 0; virtual int InitializeHandle(void* handle) const = 0; virtual int ConfigureHandle(void* handle) const = 0; virtual void DestroyHandle(void* handle) const = 0; - virtual int num_handles_required() const = 0; + virtual size_t num_handles_required() const = 0; virtual int GetHandleError(void* handle) const = 0; std::vector<void*> handles_; bool initialized_; bool enabled_; - int num_handles_; + size_t num_handles_; }; } // namespace webrtc diff --git a/webrtc/modules/audio_processing/splitting_filter.cc b/webrtc/modules/audio_processing/splitting_filter.cc index 60427e2db6..46cc9352c2 100644 --- a/webrtc/modules/audio_processing/splitting_filter.cc +++ b/webrtc/modules/audio_processing/splitting_filter.cc @@ -16,7 +16,7 @@ namespace webrtc { -SplittingFilter::SplittingFilter(int num_channels, +SplittingFilter::SplittingFilter(size_t num_channels, size_t num_bands, size_t num_frames) : num_bands_(num_bands) { @@ -24,7 +24,7 @@ SplittingFilter::SplittingFilter(int num_channels, if (num_bands_ == 2) { two_bands_states_.resize(num_channels); } else if (num_bands_ == 3) { - for (int i = 0; i < num_channels; ++i) { + for (size_t i = 0; i < num_channels; ++i) { three_band_filter_banks_.push_back(new ThreeBandFilterBank(num_frames)); } } @@ -58,8 +58,7 @@ void SplittingFilter::Synthesis(const IFChannelBuffer* bands, void SplittingFilter::TwoBandsAnalysis(const IFChannelBuffer* data, IFChannelBuffer* bands) { - RTC_DCHECK_EQ(static_cast<int>(two_bands_states_.size()), - data->num_channels()); + RTC_DCHECK_EQ(two_bands_states_.size(), data->num_channels()); for (size_t i = 0; i < two_bands_states_.size(); ++i) { WebRtcSpl_AnalysisQMF(data->ibuf_const()->channels()[i], data->num_frames(), @@ -72,8 +71,7 @@ void SplittingFilter::TwoBandsAnalysis(const IFChannelBuffer* data, void SplittingFilter::TwoBandsSynthesis(const IFChannelBuffer* bands, IFChannelBuffer* data) { - RTC_DCHECK_EQ(static_cast<int>(two_bands_states_.size()), - data->num_channels()); + RTC_DCHECK_EQ(two_bands_states_.size(), data->num_channels()); for (size_t i = 0; i < two_bands_states_.size(); ++i) { WebRtcSpl_SynthesisQMF(bands->ibuf_const()->channels(0)[i], bands->ibuf_const()->channels(1)[i], @@ -86,8 +84,7 @@ void SplittingFilter::TwoBandsSynthesis(const IFChannelBuffer* bands, void SplittingFilter::ThreeBandsAnalysis(const IFChannelBuffer* data, IFChannelBuffer* bands) { - RTC_DCHECK_EQ(static_cast<int>(three_band_filter_banks_.size()), - data->num_channels()); + RTC_DCHECK_EQ(three_band_filter_banks_.size(), data->num_channels()); for (size_t i = 0; i < three_band_filter_banks_.size(); ++i) { three_band_filter_banks_[i]->Analysis(data->fbuf_const()->channels()[i], data->num_frames(), @@ -97,8 +94,7 @@ void SplittingFilter::ThreeBandsAnalysis(const IFChannelBuffer* data, void SplittingFilter::ThreeBandsSynthesis(const IFChannelBuffer* bands, IFChannelBuffer* data) { - RTC_DCHECK_EQ(static_cast<int>(three_band_filter_banks_.size()), - data->num_channels()); + RTC_DCHECK_EQ(three_band_filter_banks_.size(), data->num_channels()); for (size_t i = 0; i < three_band_filter_banks_.size(); ++i) { three_band_filter_banks_[i]->Synthesis(bands->fbuf_const()->bands(i), bands->num_frames_per_band(), diff --git a/webrtc/modules/audio_processing/splitting_filter.h b/webrtc/modules/audio_processing/splitting_filter.h index 4698d3fe2b..6b81c2fb05 100644 --- a/webrtc/modules/audio_processing/splitting_filter.h +++ b/webrtc/modules/audio_processing/splitting_filter.h @@ -45,7 +45,7 @@ struct TwoBandsStates { // used. class SplittingFilter { public: - SplittingFilter(int num_channels, size_t num_bands, size_t num_frames); + SplittingFilter(size_t num_channels, size_t num_bands, size_t num_frames); void Analysis(const IFChannelBuffer* data, IFChannelBuffer* bands); void Synthesis(const IFChannelBuffer* bands, IFChannelBuffer* data); diff --git a/webrtc/modules/audio_processing/test/audio_file_processor.cc b/webrtc/modules/audio_processing/test/audio_file_processor.cc index 4c773566c4..56e9b4b96f 100644 --- a/webrtc/modules/audio_processing/test/audio_file_processor.cc +++ b/webrtc/modules/audio_processing/test/audio_file_processor.cc @@ -132,7 +132,8 @@ void AecDumpFileProcessor::HandleMessage(const Init& msg) { void AecDumpFileProcessor::HandleMessage(const Stream& msg) { RTC_CHECK(!msg.has_input_data()); - RTC_CHECK_EQ(in_buf_->num_channels(), msg.input_channel_size()); + RTC_CHECK_EQ(in_buf_->num_channels(), + static_cast<size_t>(msg.input_channel_size())); for (int i = 0; i < msg.input_channel_size(); ++i) { RTC_CHECK_EQ(in_buf_->num_frames() * sizeof(*in_buf_->channels()[i]), @@ -157,7 +158,8 @@ void AecDumpFileProcessor::HandleMessage(const Stream& msg) { void AecDumpFileProcessor::HandleMessage(const ReverseStream& msg) { RTC_CHECK(!msg.has_data()); - RTC_CHECK_EQ(reverse_buf_->num_channels(), msg.channel_size()); + RTC_CHECK_EQ(reverse_buf_->num_channels(), + static_cast<size_t>(msg.channel_size())); for (int i = 0; i < msg.channel_size(); ++i) { RTC_CHECK_EQ(reverse_buf_->num_frames() * sizeof(*in_buf_->channels()[i]), diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc index 6eae1e5b94..94aea17277 100644 --- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc +++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc @@ -69,7 +69,7 @@ void ConvertToFloat(const int16_t* int_data, ChannelBuffer<float>* cb) { cb->num_frames(), cb->num_channels(), cb_int.channels()); - for (int i = 0; i < cb->num_channels(); ++i) { + for (size_t i = 0; i < cb->num_channels(); ++i) { S16ToFloat(cb_int.channels()[i], cb->num_frames(), cb->channels()[i]); @@ -81,7 +81,7 @@ void ConvertToFloat(const AudioFrame& frame, ChannelBuffer<float>* cb) { } // Number of channels including the keyboard channel. -int TotalChannelsFromLayout(AudioProcessing::ChannelLayout layout) { +size_t TotalChannelsFromLayout(AudioProcessing::ChannelLayout layout) { switch (layout) { case AudioProcessing::kMono: return 1; @@ -131,7 +131,7 @@ void SetFrameTo(AudioFrame* frame, int16_t value) { } void SetFrameTo(AudioFrame* frame, int16_t left, int16_t right) { - ASSERT_EQ(2, frame->num_channels_); + ASSERT_EQ(2u, frame->num_channels_); for (size_t i = 0; i < frame->samples_per_channel_ * 2; i += 2) { frame->data_[i] = left; frame->data_[i + 1] = right; @@ -256,10 +256,10 @@ std::string OutputFilePath(std::string name, int output_rate, int reverse_input_rate, int reverse_output_rate, - int num_input_channels, - int num_output_channels, - int num_reverse_input_channels, - int num_reverse_output_channels, + size_t num_input_channels, + size_t num_output_channels, + size_t num_reverse_input_channels, + size_t num_reverse_output_channels, StreamDirection file_direction) { std::ostringstream ss; ss << name << "_i" << num_input_channels << "_" << input_rate / 1000 << "_ir" @@ -354,9 +354,9 @@ class ApmTest : public ::testing::Test { void Init(int sample_rate_hz, int output_sample_rate_hz, int reverse_sample_rate_hz, - int num_input_channels, - int num_output_channels, - int num_reverse_channels, + size_t num_input_channels, + size_t num_output_channels, + size_t num_reverse_channels, bool open_output_file); void Init(AudioProcessing* ap); void EnableAllComponents(); @@ -369,12 +369,12 @@ class ApmTest : public ::testing::Test { void ProcessDelayVerificationTest(int delay_ms, int system_delay_ms, int delay_min, int delay_max); void TestChangingChannelsInt16Interface( - int num_channels, + size_t num_channels, AudioProcessing::Error expected_return); - void TestChangingForwardChannels(int num_in_channels, - int num_out_channels, + void TestChangingForwardChannels(size_t num_in_channels, + size_t num_out_channels, AudioProcessing::Error expected_return); - void TestChangingReverseChannels(int num_rev_channels, + void TestChangingReverseChannels(size_t num_rev_channels, AudioProcessing::Error expected_return); void RunQuantizedVolumeDoesNotGetStuckTest(int sample_rate); void RunManualVolumeChangeIsPossibleTest(int sample_rate); @@ -395,7 +395,7 @@ class ApmTest : public ::testing::Test { rtc::scoped_ptr<ChannelBuffer<float> > float_cb_; rtc::scoped_ptr<ChannelBuffer<float> > revfloat_cb_; int output_sample_rate_hz_; - int num_output_channels_; + size_t num_output_channels_; FILE* far_file_; FILE* near_file_; FILE* out_file_; @@ -479,9 +479,9 @@ void ApmTest::Init(AudioProcessing* ap) { void ApmTest::Init(int sample_rate_hz, int output_sample_rate_hz, int reverse_sample_rate_hz, - int num_input_channels, - int num_output_channels, - int num_reverse_channels, + size_t num_input_channels, + size_t num_output_channels, + size_t num_reverse_channels, bool open_output_file) { SetContainerFormat(sample_rate_hz, num_input_channels, frame_, &float_cb_); output_sample_rate_hz_ = output_sample_rate_hz; @@ -813,7 +813,7 @@ TEST_F(ApmTest, DelayOffsetWithLimitsIsSetProperly) { } void ApmTest::TestChangingChannelsInt16Interface( - int num_channels, + size_t num_channels, AudioProcessing::Error expected_return) { frame_->num_channels_ = num_channels; EXPECT_EQ(expected_return, apm_->ProcessStream(frame_)); @@ -821,8 +821,8 @@ void ApmTest::TestChangingChannelsInt16Interface( } void ApmTest::TestChangingForwardChannels( - int num_in_channels, - int num_out_channels, + size_t num_in_channels, + size_t num_out_channels, AudioProcessing::Error expected_return) { const StreamConfig input_stream = {frame_->sample_rate_hz_, num_in_channels}; const StreamConfig output_stream = {output_sample_rate_hz_, num_out_channels}; @@ -833,7 +833,7 @@ void ApmTest::TestChangingForwardChannels( } void ApmTest::TestChangingReverseChannels( - int num_rev_channels, + size_t num_rev_channels, AudioProcessing::Error expected_return) { const ProcessingConfig processing_config = { {{frame_->sample_rate_hz_, apm_->num_input_channels()}, @@ -854,11 +854,11 @@ TEST_F(ApmTest, ChannelsInt16Interface) { TestChangingChannelsInt16Interface(0, apm_->kBadNumberChannelsError); - for (int i = 1; i < 4; i++) { + for (size_t i = 1; i < 4; i++) { TestChangingChannelsInt16Interface(i, kNoErr); EXPECT_EQ(i, apm_->num_input_channels()); // We always force the number of reverse channels used for processing to 1. - EXPECT_EQ(1, apm_->num_reverse_channels()); + EXPECT_EQ(1u, apm_->num_reverse_channels()); } } @@ -869,8 +869,8 @@ TEST_F(ApmTest, Channels) { TestChangingForwardChannels(0, 1, apm_->kBadNumberChannelsError); TestChangingReverseChannels(0, apm_->kBadNumberChannelsError); - for (int i = 1; i < 4; ++i) { - for (int j = 0; j < 1; ++j) { + for (size_t i = 1; i < 4; ++i) { + for (size_t j = 0; j < 1; ++j) { // Output channels much be one or match input channels. if (j == 1 || i == j) { TestChangingForwardChannels(i, j, kNoErr); @@ -879,7 +879,7 @@ TEST_F(ApmTest, Channels) { EXPECT_EQ(i, apm_->num_input_channels()); EXPECT_EQ(j, apm_->num_output_channels()); // The number of reverse channels used for processing to is always 1. - EXPECT_EQ(1, apm_->num_reverse_channels()); + EXPECT_EQ(1u, apm_->num_reverse_channels()); } else { TestChangingForwardChannels(i, j, AudioProcessing::kBadNumberChannelsError); @@ -1293,8 +1293,8 @@ TEST_F(ApmTest, AgcOnlyAdaptsWhenTargetSignalIsPresent) { const int kSampleRateHz = 16000; const size_t kSamplesPerChannel = static_cast<size_t>(AudioProcessing::kChunkSizeMs * kSampleRateHz / 1000); - const int kNumInputChannels = 2; - const int kNumOutputChannels = 1; + const size_t kNumInputChannels = 2; + const size_t kNumOutputChannels = 1; const size_t kNumChunks = 700; const float kScaleFactor = 0.25f; Config config; @@ -1327,7 +1327,7 @@ TEST_F(ApmTest, AgcOnlyAdaptsWhenTargetSignalIsPresent) { int_data.get(), float_data.get(), &src_buf)); - for (int j = 0; j < kNumInputChannels; ++j) { + for (size_t j = 0; j < kNumInputChannels; ++j) { for (size_t k = 0; k < kSamplesPerChannel; ++k) { src_buf.channels()[j][k] *= kScaleFactor; } @@ -1352,7 +1352,7 @@ TEST_F(ApmTest, AgcOnlyAdaptsWhenTargetSignalIsPresent) { int_data.get(), float_data.get(), &src_buf)); - for (int j = 0; j < kNumInputChannels; ++j) { + for (size_t j = 0; j < kNumInputChannels; ++j) { for (size_t k = 0; k < kSamplesPerChannel; ++k) { src_buf.channels()[j][k] *= kScaleFactor; } @@ -1742,7 +1742,8 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename, const audioproc::ReverseStream msg = event_msg.reverse_stream(); if (msg.channel_size() > 0) { - ASSERT_EQ(revframe_->num_channels_, msg.channel_size()); + ASSERT_EQ(revframe_->num_channels_, + static_cast<size_t>(msg.channel_size())); for (int i = 0; i < msg.channel_size(); ++i) { memcpy(revfloat_cb_->channels()[i], msg.channel(i).data(), @@ -1772,7 +1773,8 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename, } if (msg.input_channel_size() > 0) { - ASSERT_EQ(frame_->num_channels_, msg.input_channel_size()); + ASSERT_EQ(frame_->num_channels_, + static_cast<size_t>(msg.input_channel_size())); for (int i = 0; i < msg.input_channel_size(); ++i) { memcpy(float_cb_->channels()[i], msg.input_channel(i).data(), @@ -1930,9 +1932,12 @@ TEST_F(ApmTest, FloatAndIntInterfacesGiveSimilarResults) { if (test->num_input_channels() != test->num_output_channels()) continue; - const int num_render_channels = test->num_reverse_channels(); - const int num_input_channels = test->num_input_channels(); - const int num_output_channels = test->num_output_channels(); + const size_t num_render_channels = + static_cast<size_t>(test->num_reverse_channels()); + const size_t num_input_channels = + static_cast<size_t>(test->num_input_channels()); + const size_t num_output_channels = + static_cast<size_t>(test->num_output_channels()); const size_t samples_per_channel = static_cast<size_t>( test->sample_rate() * AudioProcessing::kChunkSizeMs / 1000); @@ -1975,7 +1980,7 @@ TEST_F(ApmTest, FloatAndIntInterfacesGiveSimilarResults) { test->sample_rate(), LayoutFromChannels(num_output_channels), float_cb_->channels())); - for (int j = 0; j < num_output_channels; ++j) { + for (size_t j = 0; j < num_output_channels; ++j) { FloatToS16(float_cb_->channels()[j], samples_per_channel, output_cb.channels()[j]); @@ -2008,7 +2013,7 @@ TEST_F(ApmTest, FloatAndIntInterfacesGiveSimilarResults) { 0.01); // Reset in case of downmixing. - frame_->num_channels_ = test->num_input_channels(); + frame_->num_channels_ = static_cast<size_t>(test->num_input_channels()); } rewind(far_file_); rewind(near_file_); @@ -2069,9 +2074,9 @@ TEST_F(ApmTest, Process) { Init(test->sample_rate(), test->sample_rate(), test->sample_rate(), - test->num_input_channels(), - test->num_output_channels(), - test->num_reverse_channels(), + static_cast<size_t>(test->num_input_channels()), + static_cast<size_t>(test->num_output_channels()), + static_cast<size_t>(test->num_reverse_channels()), true); int frame_count = 0; @@ -2096,7 +2101,8 @@ TEST_F(ApmTest, Process) { EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); // Ensure the frame was downmixed properly. - EXPECT_EQ(test->num_output_channels(), frame_->num_channels_); + EXPECT_EQ(static_cast<size_t>(test->num_output_channels()), + frame_->num_channels_); max_output_average += MaxAudioFrame(*frame_); @@ -2126,7 +2132,7 @@ TEST_F(ApmTest, Process) { ASSERT_EQ(frame_size, write_count); // Reset in case of downmixing. - frame_->num_channels_ = test->num_input_channels(); + frame_->num_channels_ = static_cast<size_t>(test->num_input_channels()); frame_count++; } max_output_average /= frame_count; @@ -2350,7 +2356,7 @@ class AudioProcessingTest static void SetUpTestCase() { // Create all needed output reference files. const int kNativeRates[] = {8000, 16000, 32000, 48000}; - const int kNumChannels[] = {1, 2}; + const size_t kNumChannels[] = {1, 2}; for (size_t i = 0; i < arraysize(kNativeRates); ++i) { for (size_t j = 0; j < arraysize(kNumChannels); ++j) { for (size_t k = 0; k < arraysize(kNumChannels); ++k) { @@ -2374,10 +2380,10 @@ class AudioProcessingTest int output_rate, int reverse_input_rate, int reverse_output_rate, - int num_input_channels, - int num_output_channels, - int num_reverse_input_channels, - int num_reverse_output_channels, + size_t num_input_channels, + size_t num_output_channels, + size_t num_reverse_input_channels, + size_t num_reverse_output_channels, std::string output_file_prefix) { Config config; config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); diff --git a/webrtc/modules/audio_processing/test/audioproc_float.cc b/webrtc/modules/audio_processing/test/audioproc_float.cc index d64b006b8e..a489d255c8 100644 --- a/webrtc/modules/audio_processing/test/audioproc_float.cc +++ b/webrtc/modules/audio_processing/test/audioproc_float.cc @@ -16,6 +16,7 @@ #include "gflags/gflags.h" #include "webrtc/base/checks.h" +#include "webrtc/base/format_macros.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_audio/channel_buffer.h" #include "webrtc/common_audio/wav_file.h" @@ -26,6 +27,14 @@ #include "webrtc/system_wrappers/include/tick_util.h" #include "webrtc/test/testsupport/trace_to_stderr.h" +namespace { + +bool ValidateOutChannels(const char* flagname, int32_t value) { + return value >= 0; +} + +} // namespace + DEFINE_string(dump, "", "Name of the aecdump debug file to read from."); DEFINE_string(i, "", "Name of the capture input stream file to read from."); DEFINE_string( @@ -33,6 +42,8 @@ DEFINE_string( "out.wav", "Name of the output file to write the processed capture stream to."); DEFINE_int32(out_channels, 1, "Number of output channels."); +const bool out_channels_dummy = + google::RegisterFlagValidator(&FLAGS_out_channels, &ValidateOutChannels); DEFINE_int32(out_sample_rate, 48000, "Output sample rate in Hz."); DEFINE_string(mic_positions, "", "Space delimited cartesian coordinates of microphones in meters. " @@ -117,8 +128,8 @@ int main(int argc, char* argv[]) { ap->set_stream_key_pressed(FLAGS_ts); rtc::scoped_ptr<AudioFileProcessor> processor; - auto out_file = rtc_make_scoped_ptr( - new WavWriter(FLAGS_o, FLAGS_out_sample_rate, FLAGS_out_channels)); + auto out_file = rtc_make_scoped_ptr(new WavWriter( + FLAGS_o, FLAGS_out_sample_rate, static_cast<size_t>(FLAGS_out_channels))); std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl; if (FLAGS_dump.empty()) { auto in_file = rtc_make_scoped_ptr(new WavReader(FLAGS_i)); diff --git a/webrtc/modules/audio_processing/test/debug_dump_test.cc b/webrtc/modules/audio_processing/test/debug_dump_test.cc index d2dd9c8b5a..005faa0f44 100644 --- a/webrtc/modules/audio_processing/test/debug_dump_test.cc +++ b/webrtc/modules/audio_processing/test/debug_dump_test.cc @@ -327,7 +327,8 @@ void DebugDumpTest::OnStreamEvent(const audioproc::Stream& msg) { else apm_->set_stream_key_pressed(true); - ASSERT_EQ(input_config_.num_channels(), msg.input_channel_size()); + ASSERT_EQ(input_config_.num_channels(), + static_cast<size_t>(msg.input_channel_size())); ASSERT_EQ(input_config_.num_frames() * sizeof(float), msg.input_channel(0).size()); @@ -341,7 +342,8 @@ void DebugDumpTest::OnStreamEvent(const audioproc::Stream& msg) { output_config_, output_->channels())); // Check that output of APM is bit-exact to the output in the dump. - ASSERT_EQ(output_config_.num_channels(), msg.output_channel_size()); + ASSERT_EQ(output_config_.num_channels(), + static_cast<size_t>(msg.output_channel_size())); ASSERT_EQ(output_config_.num_frames() * sizeof(float), msg.output_channel(0).size()); for (int i = 0; i < msg.output_channel_size(); ++i) { @@ -355,7 +357,8 @@ void DebugDumpTest::OnReverseStreamEvent(const audioproc::ReverseStream& msg) { ASSERT_TRUE(apm_.get()); ASSERT_GT(msg.channel_size(), 0); - ASSERT_EQ(reverse_config_.num_channels(), msg.channel_size()); + ASSERT_EQ(reverse_config_.num_channels(), + static_cast<size_t>(msg.channel_size())); ASSERT_EQ(reverse_config_.num_frames() * sizeof(float), msg.channel(0).size()); diff --git a/webrtc/modules/audio_processing/test/process_test.cc b/webrtc/modules/audio_processing/test/process_test.cc index ae6b4dc0d5..6e20a787e7 100644 --- a/webrtc/modules/audio_processing/test/process_test.cc +++ b/webrtc/modules/audio_processing/test/process_test.cc @@ -17,6 +17,7 @@ #include <algorithm> +#include "webrtc/base/format_macros.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/common.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" @@ -159,9 +160,9 @@ void void_main(int argc, char* argv[]) { int32_t sample_rate_hz = 16000; - int num_capture_input_channels = 1; - int num_capture_output_channels = 1; - int num_render_channels = 1; + size_t num_capture_input_channels = 1; + size_t num_capture_output_channels = 1; + size_t num_render_channels = 1; int samples_per_channel = sample_rate_hz / 100; @@ -207,14 +208,14 @@ void void_main(int argc, char* argv[]) { } else if (strcmp(argv[i], "-ch") == 0) { i++; ASSERT_LT(i + 1, argc) << "Specify number of channels after -ch"; - ASSERT_EQ(1, sscanf(argv[i], "%d", &num_capture_input_channels)); + ASSERT_EQ(1, sscanf(argv[i], "%" PRIuS, &num_capture_input_channels)); i++; - ASSERT_EQ(1, sscanf(argv[i], "%d", &num_capture_output_channels)); + ASSERT_EQ(1, sscanf(argv[i], "%" PRIuS, &num_capture_output_channels)); } else if (strcmp(argv[i], "-rch") == 0) { i++; ASSERT_LT(i, argc) << "Specify number of channels after -rch"; - ASSERT_EQ(1, sscanf(argv[i], "%d", &num_render_channels)); + ASSERT_EQ(1, sscanf(argv[i], "%" PRIuS, &num_render_channels)); } else if (strcmp(argv[i], "-aec") == 0) { ASSERT_EQ(apm->kNoError, apm->echo_cancellation()->Enable(true)); @@ -447,10 +448,10 @@ void void_main(int argc, char* argv[]) { if (verbose) { printf("Sample rate: %d Hz\n", sample_rate_hz); - printf("Primary channels: %d (in), %d (out)\n", + printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", num_capture_input_channels, num_capture_output_channels); - printf("Reverse channels: %d \n", num_render_channels); + printf("Reverse channels: %" PRIuS "\n", num_render_channels); } const std::string out_path = webrtc::test::OutputPath(); @@ -601,14 +602,18 @@ void void_main(int argc, char* argv[]) { if (msg.has_output_sample_rate()) { output_sample_rate = msg.output_sample_rate(); } - output_layout = LayoutFromChannels(msg.num_output_channels()); - ASSERT_EQ(kNoErr, apm->Initialize( - msg.sample_rate(), - output_sample_rate, - reverse_sample_rate, - LayoutFromChannels(msg.num_input_channels()), - output_layout, - LayoutFromChannels(msg.num_reverse_channels()))); + output_layout = + LayoutFromChannels(static_cast<size_t>(msg.num_output_channels())); + ASSERT_EQ(kNoErr, + apm->Initialize( + msg.sample_rate(), + output_sample_rate, + reverse_sample_rate, + LayoutFromChannels( + static_cast<size_t>(msg.num_input_channels())), + output_layout, + LayoutFromChannels( + static_cast<size_t>(msg.num_reverse_channels())))); samples_per_channel = msg.sample_rate() / 100; far_frame.sample_rate_hz_ = reverse_sample_rate; @@ -638,9 +643,9 @@ void void_main(int argc, char* argv[]) { if (!raw_output) { // The WAV file needs to be reset every time, because it can't change // its sample rate or number of channels. - output_wav_file.reset(new WavWriter(out_filename + ".wav", - output_sample_rate, - msg.num_output_channels())); + output_wav_file.reset(new WavWriter( + out_filename + ".wav", output_sample_rate, + static_cast<size_t>(msg.num_output_channels()))); } } else if (event_msg.type() == Event::REVERSE_STREAM) { diff --git a/webrtc/modules/audio_processing/test/test_utils.cc b/webrtc/modules/audio_processing/test/test_utils.cc index 74f8b73882..0bd70126ae 100644 --- a/webrtc/modules/audio_processing/test/test_utils.cc +++ b/webrtc/modules/audio_processing/test/test_utils.cc @@ -76,7 +76,7 @@ void WriteIntData(const int16_t* data, void WriteFloatData(const float* const* data, size_t samples_per_channel, - int num_channels, + size_t num_channels, WavWriter* wav_file, RawFile* raw_file) { size_t length = num_channels * samples_per_channel; @@ -116,7 +116,7 @@ void SetFrameSampleRate(AudioFrame* frame, sample_rate_hz / 1000; } -AudioProcessing::ChannelLayout LayoutFromChannels(int num_channels) { +AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels) { switch (num_channels) { case 1: return AudioProcessing::kMono; diff --git a/webrtc/modules/audio_processing/test/test_utils.h b/webrtc/modules/audio_processing/test/test_utils.h index 291e03e5f4..e23beb66f4 100644 --- a/webrtc/modules/audio_processing/test/test_utils.h +++ b/webrtc/modules/audio_processing/test/test_utils.h @@ -79,7 +79,7 @@ void WriteIntData(const int16_t* data, void WriteFloatData(const float* const* data, size_t samples_per_channel, - int num_channels, + size_t num_channels, WavWriter* wav_file, RawFile* raw_file); @@ -93,7 +93,7 @@ void SetFrameSampleRate(AudioFrame* frame, template <typename T> void SetContainerFormat(int sample_rate_hz, - int num_channels, + size_t num_channels, AudioFrame* frame, rtc::scoped_ptr<ChannelBuffer<T> >* cb) { SetFrameSampleRate(frame, sample_rate_hz); @@ -101,7 +101,7 @@ void SetContainerFormat(int sample_rate_hz, cb->reset(new ChannelBuffer<T>(frame->samples_per_channel_, num_channels)); } -AudioProcessing::ChannelLayout LayoutFromChannels(int num_channels); +AudioProcessing::ChannelLayout LayoutFromChannels(size_t num_channels); template <typename T> float ComputeSNR(const T* ref, const T* test, size_t length, float* variance) { diff --git a/webrtc/modules/audio_processing/test/unpack.cc b/webrtc/modules/audio_processing/test/unpack.cc index cd9205e16f..8b2b082f97 100644 --- a/webrtc/modules/audio_processing/test/unpack.cc +++ b/webrtc/modules/audio_processing/test/unpack.cc @@ -17,6 +17,7 @@ #include "gflags/gflags.h" #include "webrtc/audio_processing/debug.pb.h" +#include "webrtc/base/format_macros.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_processing/test/protobuf_utils.h" #include "webrtc/modules/audio_processing/test/test_utils.h" @@ -79,9 +80,9 @@ int do_main(int argc, char* argv[]) { size_t reverse_samples_per_channel = 0; size_t input_samples_per_channel = 0; size_t output_samples_per_channel = 0; - int num_reverse_channels = 0; - int num_input_channels = 0; - int num_output_channels = 0; + size_t num_reverse_channels = 0; + size_t num_input_channels = 0; + size_t num_output_channels = 0; rtc::scoped_ptr<WavWriter> reverse_wav_file; rtc::scoped_ptr<WavWriter> input_wav_file; rtc::scoped_ptr<WavWriter> output_wav_file; @@ -117,7 +118,7 @@ int do_main(int argc, char* argv[]) { } rtc::scoped_ptr<const float* []> data( new const float* [num_reverse_channels]); - for (int i = 0; i < num_reverse_channels; ++i) { + for (size_t i = 0; i < num_reverse_channels; ++i) { data[i] = reinterpret_cast<const float*>(msg.channel(i).data()); } WriteFloatData(data.get(), @@ -148,7 +149,7 @@ int do_main(int argc, char* argv[]) { } rtc::scoped_ptr<const float* []> data( new const float* [num_input_channels]); - for (int i = 0; i < num_input_channels; ++i) { + for (size_t i = 0; i < num_input_channels; ++i) { data[i] = reinterpret_cast<const float*>(msg.input_channel(i).data()); } WriteFloatData(data.get(), @@ -172,7 +173,7 @@ int do_main(int argc, char* argv[]) { } rtc::scoped_ptr<const float* []> data( new const float* [num_output_channels]); - for (int i = 0; i < num_output_channels; ++i) { + for (size_t i = 0; i < num_output_channels; ++i) { data[i] = reinterpret_cast<const float*>(msg.output_channel(i).data()); } @@ -268,11 +269,14 @@ int do_main(int argc, char* argv[]) { " Reverse sample rate: %d\n", reverse_sample_rate); num_input_channels = msg.num_input_channels(); - fprintf(settings_file, " Input channels: %d\n", num_input_channels); + fprintf(settings_file, " Input channels: %" PRIuS "\n", + num_input_channels); num_output_channels = msg.num_output_channels(); - fprintf(settings_file, " Output channels: %d\n", num_output_channels); + fprintf(settings_file, " Output channels: %" PRIuS "\n", + num_output_channels); num_reverse_channels = msg.num_reverse_channels(); - fprintf(settings_file, " Reverse channels: %d\n", num_reverse_channels); + fprintf(settings_file, " Reverse channels: %" PRIuS "\n", + num_reverse_channels); fprintf(settings_file, "\n"); diff --git a/webrtc/modules/audio_processing/vad/voice_activity_detector.cc b/webrtc/modules/audio_processing/vad/voice_activity_detector.cc index ef56a3574c..fc9d103918 100644 --- a/webrtc/modules/audio_processing/vad/voice_activity_detector.cc +++ b/webrtc/modules/audio_processing/vad/voice_activity_detector.cc @@ -18,7 +18,7 @@ namespace webrtc { namespace { const size_t kMaxLength = 320; -const int kNumChannels = 1; +const size_t kNumChannels = 1; const double kDefaultVoiceValue = 1.0; const double kNeutralProbability = 0.5; |