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

Unified Diff: webrtc/audio/audio_state.cc

Issue 2436033002: Replace AudioConferenceMixer with AudioMixer. (Closed)
Patch Set: Added errors and logs to AudioTransport. Created 4 years, 2 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..8d6c84b4997132d0b2b6413f35c68c903ef69f94 100644
--- a/webrtc/audio/audio_state.cc
+++ b/webrtc/audio/audio_state.cc
@@ -13,16 +13,33 @@
#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/modules/audio_mixer/audio_mixer_impl.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),
+ mixer_(AudioMixerImpl::Create()) {
aleloi 2016/10/24 11:59:14 Alternative: pass a unique_ptr<AudioMixer> and mov
ossu 2016/10/25 14:13:33 I do believe integration testing is supposed to be
the sun 2016/10/27 10:06:45 We want the mixer to be pluggable to allow alterna
aleloi 2016/11/01 15:17:35 Changes: A mixer instance is passed in the config
process_thread_checker_.DetachFromThread();
// Only one AudioState should be created per VoiceEngine.
RTC_CHECK(voe_base_->RegisterVoiceEngineObserver(*this) != -1);
+
+ // If mixer construction failed, there is no point to continue.
+ RTC_CHECK(mixer_);
the sun 2016/10/27 10:06:46 This should be a DCHECK instead. Program should ha
aleloi 2016/11/01 15:17:35 Done.
+
+ auto* const device = audio_device();
+ if (device) {
the sun 2016/10/27 10:06:45 DCHECK that instead.
aleloi 2016/11/01 15:17:35 Done.
+ audio_transport_proxy_.reset(new AudioTransportProxy(
+ voe_base_->audio_transport(), voe_base_->audio_processing(), mixer()));
+ device->RegisterAudioCallback(nullptr);
the sun 2016/10/27 10:06:45 Doesn't look like this is necessary?
aleloi 2016/11/01 15:17:35 I had a vague memory that it broke something. Webr
aleloi 2016/11/01 15:17:35 It is in Chrome. WebRtcAudioDeviceImpl::RegisterAu
+ device->RegisterAudioCallback(audio_transport_proxy_.get());
+ } else {
+ LOG(LS_ERROR) << "No audio device for sound playout.";
+ }
aleloi 2016/10/24 11:59:14 A few details, some of which should maybe be made
ossu 2016/10/25 14:13:33 When will this happen? Only in tests?
the sun 2016/10/27 10:06:46 If possible to avoid these special cases by updati
aleloi 2016/11/01 15:17:35 @ossu, yes only in tests. I've updated all tests t
}
AudioState::~AudioState() {
@@ -35,6 +52,18 @@ VoiceEngine* AudioState::voice_engine() {
return config_.voice_engine;
}
+AudioDeviceModule* AudioState::audio_device() {
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+ if (config_.audio_device_module) {
the sun 2016/10/27 10:06:45 This field appears unused right now. Just stick to
aleloi 2016/11/01 15:17:35 IIRC, that broke some test. I'll take a look at it
+ return config_.audio_device_module;
+ }
+ return voe_base_->audio_device_module();
+}
+
+rtc::scoped_refptr<AudioMixer> AudioState::mixer() const {
ossu 2016/10/25 14:13:33 Is the AudioMixer supposed to be able to outlive A
the sun 2016/10/27 10:06:45 Ultimately, it will possibly be supplied by an API
+ return mixer_;
+}
+
bool AudioState::typing_noise_detected() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
rtc::CritScope lock(&crit_sect_);

Powered by Google App Engine
This is Rietveld 408576698