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

Side by Side Diff: webrtc/modules/audio_mixer/audio_mixer_impl_unittest.cc

Issue 2692333002: Optionally disable APM limiter in AudioMixer. (Closed)
Patch Set: Deprecated old factory method. Created 3 years, 10 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, 449 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100,
450 std::numeric_limits<int16_t>::max()); 450 std::numeric_limits<int16_t>::max());
451 std::vector<bool> expected_status(kAudioSources, true); 451 std::vector<bool> expected_status(kAudioSources, true);
452 expected_status[0] = false; 452 expected_status[0] = false;
453 453
454 MixAndCompare(frames, frame_info, expected_status); 454 MixAndCompare(frames, frame_info, expected_status);
455 } 455 }
456 456
457 TEST(AudioMixer, MixingRateShouldBeDecidedByRateCalculator) { 457 TEST(AudioMixer, MixingRateShouldBeDecidedByRateCalculator) {
458 constexpr int kOutputRate = 22000; 458 constexpr int kOutputRate = 22000;
459 const auto mixer = AudioMixerImpl::CreateWithOutputRateCalculator( 459 const auto mixer = AudioMixerImpl::CreateWithOutputRateCalculatorAndLimiter(
460 std::unique_ptr<OutputRateCalculator>( 460 std::unique_ptr<OutputRateCalculator>(
461 new CustomRateCalculator(kOutputRate))); 461 new CustomRateCalculator(kOutputRate)),
462 true);
462 MockMixerAudioSource audio_source; 463 MockMixerAudioSource audio_source;
463 mixer->AddSource(&audio_source); 464 mixer->AddSource(&audio_source);
464 ResetFrame(audio_source.fake_frame()); 465 ResetFrame(audio_source.fake_frame());
465 466
466 EXPECT_CALL(audio_source, GetAudioFrameWithInfo(kOutputRate, _)) 467 EXPECT_CALL(audio_source, GetAudioFrameWithInfo(kOutputRate, _))
467 .Times(Exactly(1)); 468 .Times(Exactly(1));
468 469
469 mixer->Mix(1, &frame_for_mixing); 470 mixer->Mix(1, &frame_for_mixing);
470 } 471 }
471 472
472 TEST(AudioMixer, ZeroSourceRateShouldBeDecidedByRateCalculator) { 473 TEST(AudioMixer, ZeroSourceRateShouldBeDecidedByRateCalculator) {
ivoc 2017/02/15 16:58:46 Can you add a unit test that doesn't use a limiter
aleloi 2017/02/16 14:01:35 Testing that it doesn't limit is pretty hard, I th
473 constexpr int kOutputRate = 8000; 474 constexpr int kOutputRate = 8000;
474 const auto mixer = AudioMixerImpl::CreateWithOutputRateCalculator( 475 const auto mixer = AudioMixerImpl::CreateWithOutputRateCalculatorAndLimiter(
475 std::unique_ptr<OutputRateCalculator>( 476 std::unique_ptr<OutputRateCalculator>(
476 new CustomRateCalculator(kOutputRate))); 477 new CustomRateCalculator(kOutputRate)),
478 true);
477 479
478 mixer->Mix(1, &frame_for_mixing); 480 mixer->Mix(1, &frame_for_mixing);
479 481
480 EXPECT_EQ(kOutputRate, frame_for_mixing.sample_rate_hz_); 482 EXPECT_EQ(kOutputRate, frame_for_mixing.sample_rate_hz_);
481 } 483 }
482 } // namespace webrtc 484 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698