OLD | NEW |
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 TEST(AudioMixer, ParticipantSampleRate) { | 266 TEST(AudioMixer, ParticipantSampleRate) { |
267 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); | 267 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); |
268 | 268 |
269 MockMixerAudioSource participant; | 269 MockMixerAudioSource participant; |
270 ResetFrame(participant.fake_frame()); | 270 ResetFrame(participant.fake_frame()); |
271 | 271 |
272 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true)); | 272 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true)); |
273 for (auto frequency : {8000, 16000, 32000, 48000}) { | 273 for (auto frequency : {8000, 16000, 32000, 48000}) { |
274 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency)) | 274 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, frequency)) |
275 .Times(Exactly(1)); | 275 .Times(Exactly(1)); |
| 276 participant.fake_frame()->sample_rate_hz_ = frequency; |
| 277 participant.fake_frame()->samples_per_channel_ = frequency / 100; |
276 mixer->Mix(frequency, 1, &frame_for_mixing); | 278 mixer->Mix(frequency, 1, &frame_for_mixing); |
277 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_); | 279 EXPECT_EQ(frequency, frame_for_mixing.sample_rate_hz_); |
278 } | 280 } |
279 } | 281 } |
280 | 282 |
281 TEST(AudioMixer, ParticipantNumberOfChannels) { | 283 TEST(AudioMixer, ParticipantNumberOfChannels) { |
282 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); | 284 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); |
283 | 285 |
284 MockMixerAudioSource participant; | 286 MockMixerAudioSource participant; |
285 ResetFrame(participant.fake_frame()); | 287 ResetFrame(participant.fake_frame()); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal); | 499 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal); |
498 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted; | 500 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted; |
499 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, | 501 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, |
500 std::numeric_limits<int16_t>::max()); | 502 std::numeric_limits<int16_t>::max()); |
501 std::vector<bool> expected_status(kAudioSources, true); | 503 std::vector<bool> expected_status(kAudioSources, true); |
502 expected_status[0] = false; | 504 expected_status[0] = false; |
503 | 505 |
504 MixAndCompare(frames, frame_info, expected_status); | 506 MixAndCompare(frames, frame_info, expected_status); |
505 } | 507 } |
506 } // namespace webrtc | 508 } // namespace webrtc |
OLD | NEW |