Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: webrtc/audio/audio_state.cc

Issue 2377023002: Now pass ADM as a constructor argument to audio_state. (Closed)
Patch Set: Removed audio_transport() mock calls in tests. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/audio/audio_state.cc
diff --git a/webrtc/audio/audio_state.cc b/webrtc/audio/audio_state.cc
index e63f97af2d4fb9fd3123f37532f0553382715984..cd5a7b88ca90eb98f73793409c9f446786c012ba 100644
--- a/webrtc/audio/audio_state.cc
+++ b/webrtc/audio/audio_state.cc
@@ -14,15 +14,22 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/voice_engine/include/voe_errors.h"
+#include "webrtc/modules/audio_device/include/audio_device.h"
+#include "webrtc/modules/audio_device/include/audio_device_defines.h"
namespace webrtc {
namespace internal {
-AudioState::AudioState(const AudioState::Config& config)
- : config_(config), voe_base_(config.voice_engine) {
+AudioState::AudioState(const AudioState::Config& config,
+ webrtc::AudioDeviceModule* adm)
+ : config_(config), voe_base_(config.voice_engine), adm_(adm) {
process_thread_checker_.DetachFromThread();
+
// Only one AudioState should be created per VoiceEngine.
RTC_CHECK(voe_base_->RegisterVoiceEngineObserver(*this) != -1);
+ if (!adm_) {
+ adm_ = voe_base_->audio_device_module();
+ }
}
AudioState::~AudioState() {
@@ -35,6 +42,11 @@ VoiceEngine* AudioState::voice_engine() {
return config_.voice_engine;
}
+AudioDeviceModule* AudioState::audio_device() {
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ return adm_;
+}
+
bool AudioState::typing_noise_detected() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
rtc::CritScope lock(&crit_sect_);
@@ -73,7 +85,8 @@ void AudioState::CallbackOnError(int channel_id, int err_code) {
} // namespace internal
rtc::scoped_refptr<AudioState> AudioState::Create(
- const AudioState::Config& config) {
- return rtc::scoped_refptr<AudioState>(new internal::AudioState(config));
+ const AudioState::Config& config,
+ webrtc::AudioDeviceModule* adm) {
+ return rtc::scoped_refptr<AudioState>(new internal::AudioState(config, adm));
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698