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

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

Issue 12806009: Add OpenSL configurations (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: rebase Created 7 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: media/audio/android/opensles_input.cc
===================================================================
--- media/audio/android/opensles_input.cc (revision 189519)
+++ media/audio/android/opensles_input.cc (working copy)
@@ -193,11 +193,13 @@
SLDataSink audio_sink = { &buffer_queue, &format_ };
// Create an audio recorder.
- const SLuint32 number_of_interfaces = 1;
+ const SLuint32 number_of_interfaces = 2;
tommi (sloooow) - chröme 2013/03/21 14:56:44 what about: const SLInterfaceID interface_id[] = {
leozwang1 2013/03/21 15:33:35 Done.
const SLInterfaceID interface_id[number_of_interfaces] = {
- SL_IID_ANDROIDSIMPLEBUFFERQUEUE
+ SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
+ SL_IID_ANDROIDCONFIGURATION
};
const SLboolean interface_required[number_of_interfaces] = {
+ SL_BOOLEAN_TRUE,
SL_BOOLEAN_TRUE
};
err = (*engine)->CreateAudioRecorder(engine,
@@ -213,6 +215,24 @@
return false;
}
+ // CreateAudioRecorder and specify SL_IID_ANDROIDCONFIGURATION.
qinmin 2013/03/21 14:56:19 create AudioRecorder
leozwang1 2013/03/21 15:33:35 Done.
+ SLAndroidConfigurationItf recorder_config;
+ err = recorder_object_->GetInterface(recorder_object_.Get(),
+ SL_IID_ANDROIDCONFIGURATION,
+ &recorder_config);
+ DCHECK_EQ(SL_RESULT_SUCCESS, err);
qinmin 2013/03/21 14:56:19 the DCHECK seems redundant with the if statement b
tommi (sloooow) - chröme 2013/03/21 14:56:44 This DCHECK and the if() that follows are contradi
leozwang1 2013/03/21 15:33:35 Done.
leozwang1 2013/03/21 15:33:35 Done.
+ if (SL_RESULT_SUCCESS != err)
+ return false;
+
+ SLint32 stream_type = SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION;
+ err = (*recorder_config)->SetConfiguration(
+ recorder_config,
+ SL_ANDROID_KEY_RECORDING_PRESET,
+ &stream_type, sizeof(SLint32));
+ DCHECK_EQ(SL_RESULT_SUCCESS, err);
qinmin 2013/03/21 14:56:19 ditto
tommi (sloooow) - chröme 2013/03/21 14:56:44 same here.
leozwang1 2013/03/21 15:33:35 Done.
leozwang1 2013/03/21 15:33:35 Done.
+ if (SL_RESULT_SUCCESS != err)
+ return false;
+
// Realize the recorder object in synchronous mode.
err = recorder_object_->Realize(recorder_object_.Get(), SL_BOOLEAN_FALSE);
DCHECK_EQ(SL_RESULT_SUCCESS, err);
tommi (sloooow) - chröme 2013/03/21 14:56:44 can you fix these (and below) as well?
leozwang1 2013/03/21 15:33:35 Done.

Powered by Google App Engine
This is Rietveld 408576698