Index: webrtc/modules/audio_processing/audio_processing_impl.cc |
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc |
index b1ea6e30033f546c9b84a9e262fd240f2691f08a..4cbdae081448afeb5abc907f79d8f4f4fa189079 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc |
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc |
@@ -343,16 +343,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. |
@@ -362,8 +359,7 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) { |
} |
if (beamformer_enabled_ && |
- (static_cast<size_t>(num_in_channels) != array_geometry_.size() || |
- num_out_channels > 1)) { |
+ (num_in_channels != array_geometry_.size() || num_out_channels > 1)) { |
return kBadNumberChannelsError; |
} |
@@ -457,15 +453,15 @@ int AudioProcessingImpl::proc_split_sample_rate_hz() const { |
return split_rate_; |
} |
-int AudioProcessingImpl::num_reverse_channels() const { |
+size_t AudioProcessingImpl::num_reverse_channels() const { |
return rev_proc_format_.num_channels(); |
} |
-int AudioProcessingImpl::num_input_channels() const { |
+size_t AudioProcessingImpl::num_input_channels() const { |
return api_format_.input_stream().num_channels(); |
} |
-int AudioProcessingImpl::num_output_channels() const { |
+size_t AudioProcessingImpl::num_output_channels() const { |
return api_format_.output_stream().num_channels(); |
} |
@@ -528,7 +524,7 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, |
audioproc::Stream* msg = event_msg_->mutable_stream(); |
const size_t channel_size = |
sizeof(float) * api_format_.input_stream().num_frames(); |
- for (int i = 0; i < api_format_.input_stream().num_channels(); ++i) |
+ for (size_t i = 0; i < api_format_.input_stream().num_channels(); ++i) |
msg->add_input_channel(src[i], channel_size); |
} |
#endif |
@@ -542,7 +538,7 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, |
audioproc::Stream* msg = event_msg_->mutable_stream(); |
const size_t channel_size = |
sizeof(float) * api_format_.output_stream().num_frames(); |
- for (int i = 0; i < api_format_.output_stream().num_channels(); ++i) |
+ for (size_t i = 0; i < api_format_.output_stream().num_channels(); ++i) |
msg->add_output_channel(dest[i], channel_size); |
RETURN_ON_ERR(WriteMessageToDebugFile()); |
} |
@@ -702,7 +698,7 @@ int AudioProcessingImpl::AnalyzeReverseStream( |
return kNullPointerError; |
} |
- if (reverse_config.num_channels() <= 0) { |
+ if (reverse_config.num_channels() == 0) { |
return kBadNumberChannelsError; |
} |
@@ -719,7 +715,7 @@ int AudioProcessingImpl::AnalyzeReverseStream( |
audioproc::ReverseStream* msg = event_msg_->mutable_reverse_stream(); |
const size_t channel_size = |
sizeof(float) * api_format_.reverse_stream().num_frames(); |
- for (int i = 0; i < api_format_.reverse_stream().num_channels(); ++i) |
+ for (size_t i = 0; i < api_format_.reverse_stream().num_channels(); ++i) |
msg->add_channel(data[i], channel_size); |
RETURN_ON_ERR(WriteMessageToDebugFile()); |
} |
@@ -1131,9 +1127,12 @@ int AudioProcessingImpl::WriteInitMessage() { |
event_msg_->set_type(audioproc::Event::INIT); |
audioproc::Init* msg = event_msg_->mutable_init(); |
msg->set_sample_rate(api_format_.input_stream().sample_rate_hz()); |
- msg->set_num_input_channels(api_format_.input_stream().num_channels()); |
- msg->set_num_output_channels(api_format_.output_stream().num_channels()); |
- msg->set_num_reverse_channels(api_format_.reverse_stream().num_channels()); |
+ msg->set_num_input_channels(static_cast<google::protobuf::int32>( |
+ api_format_.input_stream().num_channels()); |
+ msg->set_num_output_channels(static_cast<google::protobuf::int32>( |
+ api_format_.output_stream().num_channels()); |
+ msg->set_num_reverse_channels(static_cast<google::protobuf::int32>( |
+ api_format_.reverse_stream().num_channels()); |
msg->set_reverse_sample_rate(api_format_.reverse_stream().sample_rate_hz()); |
msg->set_output_sample_rate(api_format_.output_stream().sample_rate_hz()); |