Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: webrtc/modules/audio_processing/test/audio_file_processor.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 reverse_config_ = 125 reverse_config_ =
126 StreamConfig(reverse_sample_rate, msg.num_reverse_channels()); 126 StreamConfig(reverse_sample_rate, msg.num_reverse_channels());
127 127
128 const ProcessingConfig config = { 128 const ProcessingConfig config = {
129 {input_config_, output_config_, reverse_config_, reverse_config_}}; 129 {input_config_, output_config_, reverse_config_, reverse_config_}};
130 RTC_CHECK_EQ(kNoErr, ap_->Initialize(config)); 130 RTC_CHECK_EQ(kNoErr, ap_->Initialize(config));
131 } 131 }
132 132
133 void AecDumpFileProcessor::HandleMessage(const Stream& msg) { 133 void AecDumpFileProcessor::HandleMessage(const Stream& msg) {
134 RTC_CHECK(!msg.has_input_data()); 134 RTC_CHECK(!msg.has_input_data());
135 RTC_CHECK_EQ(in_buf_->num_channels(), msg.input_channel_size()); 135 RTC_CHECK_EQ(in_buf_->num_channels(),
136 static_cast<size_t>(msg.input_channel_size()));
136 137
137 for (int i = 0; i < msg.input_channel_size(); ++i) { 138 for (int i = 0; i < msg.input_channel_size(); ++i) {
138 RTC_CHECK_EQ(in_buf_->num_frames() * sizeof(*in_buf_->channels()[i]), 139 RTC_CHECK_EQ(in_buf_->num_frames() * sizeof(*in_buf_->channels()[i]),
139 msg.input_channel(i).size()); 140 msg.input_channel(i).size());
140 std::memcpy(in_buf_->channels()[i], msg.input_channel(i).data(), 141 std::memcpy(in_buf_->channels()[i], msg.input_channel(i).data(),
141 msg.input_channel(i).size()); 142 msg.input_channel(i).size());
142 } 143 }
143 { 144 {
144 const auto st = ScopedTimer(mutable_proc_time()); 145 const auto st = ScopedTimer(mutable_proc_time());
145 RTC_CHECK_EQ(kNoErr, ap_->set_stream_delay_ms(msg.delay())); 146 RTC_CHECK_EQ(kNoErr, ap_->set_stream_delay_ms(msg.delay()));
146 ap_->echo_cancellation()->set_stream_drift_samples(msg.drift()); 147 ap_->echo_cancellation()->set_stream_drift_samples(msg.drift());
147 if (msg.has_keypress()) { 148 if (msg.has_keypress()) {
148 ap_->set_stream_key_pressed(msg.keypress()); 149 ap_->set_stream_key_pressed(msg.keypress());
149 } 150 }
150 RTC_CHECK_EQ(kNoErr, 151 RTC_CHECK_EQ(kNoErr,
151 ap_->ProcessStream(in_buf_->channels(), input_config_, 152 ap_->ProcessStream(in_buf_->channels(), input_config_,
152 output_config_, out_buf_.channels())); 153 output_config_, out_buf_.channels()));
153 } 154 }
154 155
155 buffer_writer_.Write(out_buf_); 156 buffer_writer_.Write(out_buf_);
156 } 157 }
157 158
158 void AecDumpFileProcessor::HandleMessage(const ReverseStream& msg) { 159 void AecDumpFileProcessor::HandleMessage(const ReverseStream& msg) {
159 RTC_CHECK(!msg.has_data()); 160 RTC_CHECK(!msg.has_data());
160 RTC_CHECK_EQ(reverse_buf_->num_channels(), msg.channel_size()); 161 RTC_CHECK_EQ(reverse_buf_->num_channels(),
162 static_cast<size_t>(msg.channel_size()));
161 163
162 for (int i = 0; i < msg.channel_size(); ++i) { 164 for (int i = 0; i < msg.channel_size(); ++i) {
163 RTC_CHECK_EQ(reverse_buf_->num_frames() * sizeof(*in_buf_->channels()[i]), 165 RTC_CHECK_EQ(reverse_buf_->num_frames() * sizeof(*in_buf_->channels()[i]),
164 msg.channel(i).size()); 166 msg.channel(i).size());
165 std::memcpy(reverse_buf_->channels()[i], msg.channel(i).data(), 167 std::memcpy(reverse_buf_->channels()[i], msg.channel(i).data(),
166 msg.channel(i).size()); 168 msg.channel(i).size());
167 } 169 }
168 { 170 {
169 const auto st = ScopedTimer(mutable_proc_time()); 171 const auto st = ScopedTimer(mutable_proc_time());
170 // TODO(ajm): This currently discards the processed output, which is needed 172 // TODO(ajm): This currently discards the processed output, which is needed
171 // for e.g. intelligibility enhancement. 173 // for e.g. intelligibility enhancement.
172 RTC_CHECK_EQ(kNoErr, ap_->ProcessReverseStream( 174 RTC_CHECK_EQ(kNoErr, ap_->ProcessReverseStream(
173 reverse_buf_->channels(), reverse_config_, 175 reverse_buf_->channels(), reverse_config_,
174 reverse_config_, reverse_buf_->channels())); 176 reverse_config_, reverse_buf_->channels()));
175 } 177 }
176 } 178 }
177 179
178 } // namespace webrtc 180 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/splitting_filter.cc ('k') | webrtc/modules/audio_processing/test/audio_processing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698