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

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

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

Powered by Google App Engine
This is Rietveld 408576698