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

Unified Diff: webrtc/voice_engine/voe_base_impl.cc

Issue 2753453002: Adding AudioDeviceDataObserver interface (Closed)
Patch Set: Fix gn typo Created 3 years, 9 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/voice_engine/voe_base_impl.cc
diff --git a/webrtc/voice_engine/voe_base_impl.cc b/webrtc/voice_engine/voe_base_impl.cc
index 5a037bf8ca9fa395756f8ab4632996572cd9757b..904e4b82afe0962ad37040e93292c15d5c401c3d 100644
--- a/webrtc/voice_engine/voe_base_impl.cc
+++ b/webrtc/voice_engine/voe_base_impl.cc
@@ -8,6 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <string>
+#include <algorithm>
+
#include "webrtc/voice_engine/voe_base_impl.h"
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
@@ -228,13 +231,6 @@ int VoEBaseImpl::Init(
"Init() failed to register event observer for the ADM");
}
- // Register the AudioTransport implementation
the sun 2017/03/21 21:42:50 You shouldn't need to move this. Setting the audio
lliuu 2017/03/22 18:50:30 Oh I see, then the crashing bug should be fixed on
- if (shared_->audio_device()->RegisterAudioCallback(this) != 0) {
- shared_->SetLastError(
- VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning,
- "Init() failed to register audio callback for the ADM");
- }
-
// ADM initialization
if (shared_->audio_device()->Init() != 0) {
shared_->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceError,
@@ -297,6 +293,15 @@ int VoEBaseImpl::Init(
}
shared_->set_audio_processing(audioproc);
+ // Register the AudioTransport implementation
+ // This needs to be called after audio processing module is set
+ // to avoid potential crashes.
+ if (shared_->audio_device()->RegisterAudioCallback(this) != 0) {
+ shared_->SetLastError(
+ VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning,
+ "Init() failed to register audio callback for the ADM");
+ }
+
// Set the error state for any failures in this block.
shared_->SetLastError(VE_APM_ERROR);
// Configure AudioProcessing components.

Powered by Google App Engine
This is Rietveld 408576698