Index: webrtc/audio/audio_state.cc |
diff --git a/webrtc/audio/audio_state.cc b/webrtc/audio/audio_state.cc |
index e63f97af2d4fb9fd3123f37532f0553382715984..bb80b2573dcf47071a2261d6bd5c83b8916c4dd3 100644 |
--- a/webrtc/audio/audio_state.cc |
+++ b/webrtc/audio/audio_state.cc |
@@ -13,6 +13,7 @@ |
#include "webrtc/base/atomicops.h" |
#include "webrtc/base/checks.h" |
#include "webrtc/base/logging.h" |
+#include "webrtc/modules/audio_device/include/audio_device.h" |
#include "webrtc/voice_engine/include/voe_errors.h" |
namespace webrtc { |
@@ -23,6 +24,13 @@ AudioState::AudioState(const AudioState::Config& config) |
process_thread_checker_.DetachFromThread(); |
// Only one AudioState should be created per VoiceEngine. |
RTC_CHECK(voe_base_->RegisterVoiceEngineObserver(*this) != -1); |
+ |
+ auto* const device = audio_device(); |
+ RTC_DCHECK(device); |
+ audio_transport_proxy_.reset(new AudioTransportProxy( |
+ voe_base_->audio_transport(), voe_base_->audio_processing(), mixer())); |
+ device->RegisterAudioCallback(nullptr); |
+ device->RegisterAudioCallback(audio_transport_proxy_.get()); |
} |
AudioState::~AudioState() { |
@@ -35,6 +43,15 @@ VoiceEngine* AudioState::voice_engine() { |
return config_.voice_engine; |
} |
+AudioDeviceModule* AudioState::audio_device() { |
+ RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
+ return voe_base_->audio_device_module(); |
+} |
+ |
+rtc::scoped_refptr<AudioMixer> AudioState::mixer() const { |
+ return config_.audio_mixer; |
+} |
+ |
bool AudioState::typing_noise_detected() const { |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
rtc::CritScope lock(&crit_sect_); |