Index: webrtc/audio/audio_state.cc |
diff --git a/webrtc/audio/audio_state.cc b/webrtc/audio/audio_state.cc |
index e63f97af2d4fb9fd3123f37532f0553382715984..95a90a5bf1153ba0d51b1c669cdac0a8936d59a8 100644 |
--- a/webrtc/audio/audio_state.cc |
+++ b/webrtc/audio/audio_state.cc |
@@ -13,16 +13,28 @@ |
#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 { |
namespace internal { |
AudioState::AudioState(const AudioState::Config& config) |
- : config_(config), voe_base_(config.voice_engine) { |
+ : config_(config), |
+ voe_base_(config.voice_engine), |
+ audio_transport_proxy_(voe_base_->audio_transport(), |
+ voe_base_->audio_processing(), |
+ config_.audio_mixer) { |
process_thread_checker_.DetachFromThread(); |
// Only one AudioState should be created per VoiceEngine. |
RTC_CHECK(voe_base_->RegisterVoiceEngineObserver(*this) != -1); |
+ |
+ auto* const device = voe_base_->audio_device_module(); |
+ RTC_DCHECK(device); |
+ |
+ // This is needed for the Chrome implementation of RegisterAudioCallback. |
+ device->RegisterAudioCallback(nullptr); |
+ device->RegisterAudioCallback(&audio_transport_proxy_); |
} |
AudioState::~AudioState() { |
@@ -35,6 +47,10 @@ VoiceEngine* AudioState::voice_engine() { |
return config_.voice_engine; |
} |
+rtc::scoped_refptr<AudioMixer> AudioState::mixer() { |
+ return config_.audio_mixer; |
+} |
+ |
bool AudioState::typing_noise_detected() const { |
RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
rtc::CritScope lock(&crit_sect_); |