Volume buttons in AppRTCDemo should affect output audio volume (part II).

See https://webrtc-codereview.appspot.com/32399004/ for part I.

BUG=3279
TEST=AppRTC demo
R=perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/27059004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7654 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrika@webrtc.org 2014-11-06 15:48:05 +00:00
parent dced5d7835
commit dd43bbed8f
2 changed files with 36 additions and 0 deletions

View File

@ -360,6 +360,24 @@ bool OpenSlesInput::CreateAudioRecorder() {
req),
false);
SLAndroidConfigurationItf recorder_config;
OPENSL_RETURN_ON_FAILURE(
(*sles_recorder_)->GetInterface(sles_recorder_,
SL_IID_ANDROIDCONFIGURATION,
&recorder_config),
false);
// Set audio recorder configuration to
// SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION which ensures that we
// use the main microphone tuned for audio communications.
SLint32 stream_type = SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION;
OPENSL_RETURN_ON_FAILURE(
(*recorder_config)->SetConfiguration(recorder_config,
SL_ANDROID_KEY_RECORDING_PRESET,
&stream_type,
sizeof(SLint32)),
false);
// Realize the recorder in synchronous mode.
OPENSL_RETURN_ON_FAILURE((*sles_recorder_)->Realize(sles_recorder_,
SL_BOOLEAN_FALSE),

View File

@ -407,6 +407,24 @@ bool OpenSlesOutput::CreateAudioPlayer() {
&audio_source, &audio_sink,
kNumInterfaces, ids, req),
false);
SLAndroidConfigurationItf player_config;
OPENSL_RETURN_ON_FAILURE(
(*sles_player_)->GetInterface(sles_player_,
SL_IID_ANDROIDCONFIGURATION,
&player_config),
false);
// Set audio player configuration to SL_ANDROID_STREAM_VOICE which corresponds
// to android.media.AudioManager.STREAM_VOICE_CALL.
SLint32 stream_type = SL_ANDROID_STREAM_VOICE;
OPENSL_RETURN_ON_FAILURE(
(*player_config)->SetConfiguration(player_config,
SL_ANDROID_KEY_STREAM_TYPE,
&stream_type,
sizeof(SLint32)),
false);
// Realize the player in synchronous mode.
OPENSL_RETURN_ON_FAILURE((*sles_player_)->Realize(sles_player_,
SL_BOOLEAN_FALSE),