Chromium Code Reviews| 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. |