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

Side by Side Diff: webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc

Issue 2298163002: Simplifications of the mixing algorithm. (Closed)
Patch Set: Rebase. Created 4 years, 3 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 TEST(AudioMixer, ParticipantSampleRate) { 264 TEST(AudioMixer, ParticipantSampleRate) {
265 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 265 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
266 266
267 MockMixerAudioSource participant; 267 MockMixerAudioSource participant;
268 ResetFrame(participant.fake_frame()); 268 ResetFrame(participant.fake_frame());
269 269
270 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true)); 270 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true));
271 for (auto frequency : {8000, 16000, 32000, 48000}) { 271 for (auto frequency : {8000, 16000, 32000, 48000}) {
272 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency)) 272 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency))
273 .Times(Exactly(1)); 273 .Times(Exactly(1));
274 participant.fake_frame()->sample_rate_hz_ = frequency;
275 participant.fake_frame()->samples_per_channel_ = frequency / 100;
274 mixer->Mix(frequency, 1, &frame_for_mixing); 276 mixer->Mix(frequency, 1, &frame_for_mixing);
275 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_); 277 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_);
276 } 278 }
277 } 279 }
278 280
279 TEST(AudioMixer, ParticipantNumberOfChannels) { 281 TEST(AudioMixer, ParticipantNumberOfChannels) {
280 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 282 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
281 283
282 MockMixerAudioSource participant; 284 MockMixerAudioSource participant;
283 ResetFrame(participant.fake_frame()); 285 ResetFrame(participant.fake_frame());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal); 467 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal);
466 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted; 468 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted;
467 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, 469 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100,
468 std::numeric_limits<int16_t>::max()); 470 std::numeric_limits<int16_t>::max());
469 std::vector<bool> expected_status(kAudioSources, true); 471 std::vector<bool> expected_status(kAudioSources, true);
470 expected_status[0] = false; 472 expected_status[0] = false;
471 473
472 MixAndCompare(frames, frame_info, expected_status); 474 MixAndCompare(frames, frame_info, expected_status);
473 } 475 }
474 } // namespace webrtc 476 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698