Passed AudioMixer to AudioState::Config.

This is a refactoring change in preparation for enabling AudioMixer
with the goal to have a small CL as possible for passing audio through
the new audio mixer in WebRTC. The dependent CL https://codereview.webrtc.org/2436033002/
enables the mixer.

An object of class AudioState is shared across different webrtc audio
connections. It is created in tests and in
WebRTCVoiceEngine. AudioState is constructed by passing a Config
struct, where one argument is scoped_refptr<AudioMixer>.

Populating this field has now been mandatory. Tests and
WebRTCVoiceEngine create and pass either a AudioMixerImpl.
WebRTCVoiceEngine passes a real AudioMixer, which is
currently unused.

An alternative would have tests pass a mocked audio mixer. We
chose not to do that, because we believe that tests should use
the real thing unless there are reasons against it. Construction
time is not an issue, because the real mixer is relatively
lightweight.

We couldn't find a way to test any mixer-related changes in AudioState
before the mixes is connected. The next dependent CL
https://codereview.webrtc.org/2436033002/ contains unit tests for
mixer usage.

BUG=webrtc:6346

Review-Url: https://codereview.webrtc.org/2469743002
Cr-Commit-Position: refs/heads/master@{#15134}
This commit is contained in:
aleloi
2016-11-17 06:48:48 -08:00
committed by Commit bot
parent dd31071e19
commit 10111bc495
19 changed files with 34 additions and 5 deletions

View File

@ -20,6 +20,7 @@
#include "webrtc/config.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/metrics_default.h"
@ -159,6 +160,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
AudioState::Config send_audio_state_config;
send_audio_state_config.voice_engine = voice_engine;
send_audio_state_config.audio_mixer = AudioMixerImpl::Create();
Call::Config sender_config(&event_log_);
sender_config.audio_state = AudioState::Create(send_audio_state_config);
Call::Config receiver_config(&event_log_);
@ -264,7 +266,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
Start();
fake_audio_device.Start();
EXPECT_EQ(0, voe_base->StartPlayout(recv_channel_id));
audio_receive_stream->Start();
EXPECT_EQ(0, voe_base->StartSend(send_channel_id));
EXPECT_TRUE(observer.Wait())