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.
|