| Index: webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc
|
| diff --git a/webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc b/webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc
|
| index 38f2b2ebff569981ea4b902f08748c9c316ab957..41de3e24d13540dffc51bc93af78439769ee6a28 100644
|
| --- a/webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc
|
| +++ b/webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc
|
| @@ -370,6 +370,65 @@ TEST(AudioMixer, ParticipantNumberOfChannels) {
|
| }
|
| }
|
|
|
| +// Test that the volume is reported as zero when the mixer input is
|
| +// frames with no sound.
|
| +TEST(AudioMixer, ZeroVolume) {
|
| + const int kId = 1;
|
| + std::unique_ptr<NewAudioConferenceMixer> mixer(
|
| + NewAudioConferenceMixer::Create(kId));
|
| + AudioFrame frame_for_mixing;
|
| +
|
| + MockMixerAudioSource participant;
|
| + participant.fake_frame()->sample_rate_hz_ = 8000;
|
| + participant.fake_frame()->num_channels_ = 1;
|
| +
|
| + // Frame duration 10ms.
|
| + participant.fake_frame()->samples_per_channel_ = 8000 / 100;
|
| +
|
| + EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true));
|
| + for (size_t i = 0; i < 11; i++) {
|
| + EXPECT_CALL(participant, GetAudioFrameWithMuted(_, 8000)).Times(Exactly(1));
|
| + mixer->Mix(8000, 1, &frame_for_mixing);
|
| + }
|
| +
|
| + EXPECT_EQ(static_cast<uint32_t>(0), mixer->GetSpeechOutputLevel());
|
| + EXPECT_EQ(static_cast<uint32_t>(0), mixer->GetSpeechOutputLevelFullRange());
|
| +}
|
| +
|
| +// Test that the volume is reported as full when the mixer input is
|
| +// full frames.
|
| +TEST(AudioMixer, FullVolume) {
|
| + const int kId = 1;
|
| + std::unique_ptr<NewAudioConferenceMixer> mixer(
|
| + NewAudioConferenceMixer::Create(kId));
|
| + AudioFrame frame_for_mixing;
|
| +
|
| + MockMixerAudioSource participant;
|
| + participant.fake_frame()->sample_rate_hz_ = 8000;
|
| + participant.fake_frame()->num_channels_ = 1;
|
| +
|
| + // Frame duration 10ms.
|
| + participant.fake_frame()->samples_per_channel_ = 8000 / 100;
|
| +
|
| + // Fill participant frame data with maximal sound.
|
| + std::fill(participant.fake_frame()->data_,
|
| + participant.fake_frame()->data_ + 8000 / 100,
|
| + std::numeric_limits<int16_t>::max());
|
| +
|
| + EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true));
|
| + for (size_t i = 0; i < 11; i++) {
|
| + EXPECT_CALL(participant, GetAudioFrameWithMuted(_, 8000)).Times(Exactly(1));
|
| + mixer->Mix(8000, 1, &frame_for_mixing);
|
| + }
|
| +
|
| + // 9 is the highest possible audio level
|
| + EXPECT_EQ(static_cast<uint32_t>(9), mixer->GetSpeechOutputLevel());
|
| +
|
| + // 0x7fff = 32767 is the highest full range audio level.
|
| + EXPECT_EQ(static_cast<uint32_t>(std::numeric_limits<int16_t>::max()),
|
| + mixer->GetSpeechOutputLevelFullRange());
|
| +}
|
| +
|
| TEST_F(BothMixersTest, CompareInitialFrameAudio) {
|
| EXPECT_CALL(participant_, GetAudioFrameWithMuted(_, _)).Times(Exactly(1));
|
|
|
|
|