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

Side by Side Diff: webrtc/modules/audio_processing/test/debug_dump_test.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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 ASSERT_TRUE(apm_.get()); 320 ASSERT_TRUE(apm_.get());
321 321
322 EXPECT_NOERR(apm_->gain_control()->set_stream_analog_level(msg.level())); 322 EXPECT_NOERR(apm_->gain_control()->set_stream_analog_level(msg.level()));
323 EXPECT_NOERR(apm_->set_stream_delay_ms(msg.delay())); 323 EXPECT_NOERR(apm_->set_stream_delay_ms(msg.delay()));
324 apm_->echo_cancellation()->set_stream_drift_samples(msg.drift()); 324 apm_->echo_cancellation()->set_stream_drift_samples(msg.drift());
325 if (msg.has_keypress()) 325 if (msg.has_keypress())
326 apm_->set_stream_key_pressed(msg.keypress()); 326 apm_->set_stream_key_pressed(msg.keypress());
327 else 327 else
328 apm_->set_stream_key_pressed(true); 328 apm_->set_stream_key_pressed(true);
329 329
330 ASSERT_EQ(input_config_.num_channels(), msg.input_channel_size()); 330 ASSERT_EQ(input_config_.num_channels(),
331 static_cast<size_t>(msg.input_channel_size()));
331 ASSERT_EQ(input_config_.num_frames() * sizeof(float), 332 ASSERT_EQ(input_config_.num_frames() * sizeof(float),
332 msg.input_channel(0).size()); 333 msg.input_channel(0).size());
333 334
334 for (int i = 0; i < msg.input_channel_size(); ++i) { 335 for (int i = 0; i < msg.input_channel_size(); ++i) {
335 memcpy(input_->channels()[i], msg.input_channel(i).data(), 336 memcpy(input_->channels()[i], msg.input_channel(i).data(),
336 msg.input_channel(i).size()); 337 msg.input_channel(i).size());
337 } 338 }
338 339
339 ASSERT_EQ(AudioProcessing::kNoError, 340 ASSERT_EQ(AudioProcessing::kNoError,
340 apm_->ProcessStream(input_->channels(), input_config_, 341 apm_->ProcessStream(input_->channels(), input_config_,
341 output_config_, output_->channels())); 342 output_config_, output_->channels()));
342 343
343 // Check that output of APM is bit-exact to the output in the dump. 344 // Check that output of APM is bit-exact to the output in the dump.
344 ASSERT_EQ(output_config_.num_channels(), msg.output_channel_size()); 345 ASSERT_EQ(output_config_.num_channels(),
346 static_cast<size_t>(msg.output_channel_size()));
345 ASSERT_EQ(output_config_.num_frames() * sizeof(float), 347 ASSERT_EQ(output_config_.num_frames() * sizeof(float),
346 msg.output_channel(0).size()); 348 msg.output_channel(0).size());
347 for (int i = 0; i < msg.output_channel_size(); ++i) { 349 for (int i = 0; i < msg.output_channel_size(); ++i) {
348 ASSERT_EQ(0, memcmp(output_->channels()[i], msg.output_channel(i).data(), 350 ASSERT_EQ(0, memcmp(output_->channels()[i], msg.output_channel(i).data(),
349 msg.output_channel(i).size())); 351 msg.output_channel(i).size()));
350 } 352 }
351 } 353 }
352 354
353 void DebugDumpTest::OnReverseStreamEvent(const audioproc::ReverseStream& msg) { 355 void DebugDumpTest::OnReverseStreamEvent(const audioproc::ReverseStream& msg) {
354 // APM should have been created. 356 // APM should have been created.
355 ASSERT_TRUE(apm_.get()); 357 ASSERT_TRUE(apm_.get());
356 358
357 ASSERT_GT(msg.channel_size(), 0); 359 ASSERT_GT(msg.channel_size(), 0);
358 ASSERT_EQ(reverse_config_.num_channels(), msg.channel_size()); 360 ASSERT_EQ(reverse_config_.num_channels(),
361 static_cast<size_t>(msg.channel_size()));
359 ASSERT_EQ(reverse_config_.num_frames() * sizeof(float), 362 ASSERT_EQ(reverse_config_.num_frames() * sizeof(float),
360 msg.channel(0).size()); 363 msg.channel(0).size());
361 364
362 for (int i = 0; i < msg.channel_size(); ++i) { 365 for (int i = 0; i < msg.channel_size(); ++i) {
363 memcpy(reverse_->channels()[i], msg.channel(i).data(), 366 memcpy(reverse_->channels()[i], msg.channel(i).data(),
364 msg.channel(i).size()); 367 msg.channel(i).size());
365 } 368 }
366 369
367 ASSERT_EQ(AudioProcessing::kNoError, 370 ASSERT_EQ(AudioProcessing::kNoError,
368 apm_->ProcessReverseStream(reverse_->channels(), 371 apm_->ProcessReverseStream(reverse_->channels(),
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 config.Set<ExperimentalNs>(new ExperimentalNs(true)); 603 config.Set<ExperimentalNs>(new ExperimentalNs(true));
601 DebugDumpGenerator generator(config); 604 DebugDumpGenerator generator(config);
602 generator.StartRecording(); 605 generator.StartRecording();
603 generator.Process(100); 606 generator.Process(100);
604 generator.StopRecording(); 607 generator.StopRecording();
605 VerifyDebugDump(generator.dump_file_name()); 608 VerifyDebugDump(generator.dump_file_name());
606 } 609 }
607 610
608 } // namespace test 611 } // namespace test
609 } // namespace webrtc 612 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/audioproc_float.cc ('k') | webrtc/modules/audio_processing/test/process_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698