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

Unified Diff: media/audio/android/opensles_output.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_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);
« media/audio/android/opensles_input.cc ('K') | « media/audio/android/opensles_input.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698