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

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

Issue 2286343002: Less lock acquisitions for AudioMixer. (Closed)
Patch Set: A huge pile of messy changes (left because of the comments) 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 TEST(AudioMixer, ParticipantSampleRate) { 205 TEST(AudioMixer, ParticipantSampleRate) {
206 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 206 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
207 207
208 MockMixerAudioSource participant; 208 MockMixerAudioSource participant;
209 ResetFrame(participant.fake_frame()); 209 ResetFrame(participant.fake_frame());
210 210
211 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true)); 211 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true));
212 for (auto frequency : {8000, 16000, 32000, 48000}) { 212 for (auto frequency : {8000, 16000, 32000, 48000}) {
213 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency)) 213 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency))
214 .Times(Exactly(1)); 214 .Times(Exactly(1));
215 participant.fake_frame()->sample_rate_hz_ = frequency;
216 participant.fake_frame()->samples_per_channel_ = frequency / 100;
aleloi 2016/08/30 15:13:34 There are now RTC_DCHECKs for receiving correct ra
215 mixer->Mix(frequency, 1, &frame_for_mixing); 217 mixer->Mix(frequency, 1, &frame_for_mixing);
216 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_); 218 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_);
217 } 219 }
218 } 220 }
219 221
220 TEST(AudioMixer, ParticipantNumberOfChannels) { 222 TEST(AudioMixer, ParticipantNumberOfChannels) {
221 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 223 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
222 224
223 MockMixerAudioSource participant; 225 MockMixerAudioSource participant;
224 ResetFrame(participant.fake_frame()); 226 ResetFrame(participant.fake_frame());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal); 408 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal);
407 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted; 409 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted;
408 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, 410 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100,
409 std::numeric_limits<int16_t>::max()); 411 std::numeric_limits<int16_t>::max());
410 std::vector<bool> expected_status(kAudioSources, true); 412 std::vector<bool> expected_status(kAudioSources, true);
411 expected_status[0] = false; 413 expected_status[0] = false;
412 414
413 MixAndCompare(frames, frame_info, expected_status); 415 MixAndCompare(frames, frame_info, expected_status);
414 } 416 }
415 } // namespace webrtc 417 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698