Chromium Code Reviews| Index: media/audio/android/opensles_output.cc |
| =================================================================== |
| --- media/audio/android/opensles_output.cc (revision 189519) |
| +++ media/audio/android/opensles_output.cc (working copy) |
| @@ -191,11 +191,15 @@ |
| SLDataSink audio_sink = { &locator_output_mix, NULL }; |
| // Create an audio player. |
| - const SLuint32 number_of_interfaces = 1; |
| + const SLuint32 number_of_interfaces = 3; |
|
tommi (sloooow) - chröme
2013/03/21 14:56:44
could use arraysize() here.
leozwang1
2013/03/21 15:33:35
Done.
|
| const SLInterfaceID interface_id[number_of_interfaces] = { |
| - SL_IID_BUFFERQUEUE |
| + SL_IID_BUFFERQUEUE, |
| + SL_IID_VOLUME, |
| + SL_IID_ANDROIDCONFIGURATION |
| }; |
| const SLboolean interface_required[number_of_interfaces] = { |
| + SL_BOOLEAN_TRUE, |
| + SL_BOOLEAN_TRUE, |
| SL_BOOLEAN_TRUE |
| }; |
| err = (*engine)->CreateAudioPlayer(engine, |
| @@ -211,6 +215,23 @@ |
| return false; |
| } |
| + // CreateAudioPlayer and specify SL_IID_ANDROIDCONFIGURATION. |
|
qinmin
2013/03/21 14:56:19
white space in CreateAudioPlayer
leozwang1
2013/03/21 15:33:35
Done.
|
| + SLAndroidConfigurationItf player_config; |
| + err = player_object_->GetInterface(player_object_.Get(), |
| + SL_IID_ANDROIDCONFIGURATION, |
| + &player_config); |
| + 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 thing for DCHECK vs if()
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_STREAM_VOICE; |
| + err = (*player_config)->SetConfiguration(player_config, |
| + SL_ANDROID_KEY_STREAM_TYPE, |
| + &stream_type, sizeof(SLint32)); |
| + DCHECK_EQ(SL_RESULT_SUCCESS, err); |
|
qinmin
2013/03/21 14:56:19
ditto
leozwang1
2013/03/21 15:33:35
Done.
|
| + if (SL_RESULT_SUCCESS != err) |
| + return false; |
| + |
| // Realize the player object in synchronous mode. |
| err = player_object_->Realize(player_object_.Get(), SL_BOOLEAN_FALSE); |
| DCHECK_EQ(SL_RESULT_SUCCESS, err); |