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

Unified Diff: media/audio/android/audio_manager_android.cc

Issue 99033003: Enable platform echo cancellation through the AudioRecord path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 7 years 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: media/audio/android/audio_manager_android.cc
diff --git a/media/audio/android/audio_manager_android.cc b/media/audio/android/audio_manager_android.cc
index b588768bbd08c1fcfbb75df70248a9da752a28a4..75840052f3c3bbc4fef2ada009dd8adf2b0c9cc7 100644
--- a/media/audio/android/audio_manager_android.cc
+++ b/media/audio/android/audio_manager_android.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "jni/AudioManagerAndroid_jni.h"
+#include "media/audio/android/audio_record_input.h"
#include "media/audio/android/opensles_input.h"
#include "media/audio/android/opensles_output.h"
#include "media/audio/audio_manager.h"
@@ -111,10 +112,13 @@ AudioParameters AudioManagerAndroid::GetInputStreamParameters(
base::android::AttachCurrentThread(), GetNativeOutputSampleRate(),
ChannelLayoutToChannelCount(channel_layout));
- return AudioParameters(
+ AudioParameters params(
AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
GetNativeOutputSampleRate(), 16,
buffer_size <= 0 ? kDefaultInputBufferSize : buffer_size);
+ params.set_use_platform_aec(Java_AudioManagerAndroid_isPlatformAECSupported(
+ base::android::AttachCurrentThread()));
+ return params;
}
AudioOutputStream* AudioManagerAndroid::MakeAudioOutputStream(
@@ -189,7 +193,14 @@ AudioInputStream* AudioManagerAndroid::MakeLowLatencyInputStream(
// device, i.e., this selection does also switch the output device.
// All input and output streams will be affected by the device selection.
SetAudioDevice(device_id);
- return new OpenSLESInputStream(this, params);
+ if (params.use_platform_aec()) {
tommi (sloooow) - chröme 2013/12/06 12:11:34 Just checking - is there no chance that we can hav
ajm 2013/12/10 06:37:16 Right, that would be a programming error. For test
+ // The platform AEC can only be enabled through the AudioRecord path.
+ DVLOG(1) << "Creating AudioRecordInputStream";
+ return new AudioRecordInputStream(this, params);
+ } else {
tommi (sloooow) - chröme 2013/12/06 12:11:34 nit: no need for 'else'
ajm 2013/12/10 06:37:16 Done.
+ DVLOG(1) << "Creating OpenSLESInputStream";
+ return new OpenSLESInputStream(this, params);
+ }
}
int AudioManagerAndroid::GetOptimalOutputFrameSize(int sample_rate,

Powered by Google App Engine
This is Rietveld 408576698