Fix for "Android audio playout doesn't support non-call media stream"

BUG=webrtc:4767
R=magjed@webrtc.org

Review URL: https://codereview.webrtc.org/1419693004 .

Cr-Commit-Position: refs/heads/master@{#10435}
This commit is contained in:
henrika
2015-10-28 13:06:15 +01:00
parent 83585c9075
commit 6408174cdc
8 changed files with 94 additions and 16 deletions

View File

@ -38,6 +38,7 @@ namespace webrtc {
OpenSLESPlayer::OpenSLESPlayer(AudioManager* audio_manager)
: audio_parameters_(audio_manager->GetPlayoutAudioParameters()),
stream_type_(audio_manager->OutputStreamType()),
audio_device_buffer_(NULL),
initialized_(false),
playing_(false),
@ -48,6 +49,9 @@ OpenSLESPlayer::OpenSLESPlayer(AudioManager* audio_manager)
simple_buffer_queue_(nullptr),
volume_(nullptr) {
ALOGD("ctor%s", GetThreadInfo().c_str());
RTC_DCHECK(stream_type_ == SL_ANDROID_STREAM_VOICE ||
stream_type_ == SL_ANDROID_STREAM_RING ||
stream_type_ == SL_ANDROID_STREAM_MEDIA) << stream_type_;
// Use native audio output parameters provided by the audio manager and
// define the PCM format structure.
pcm_format_ = CreatePCMConfiguration(audio_parameters_.channels(),
@ -347,7 +351,7 @@ bool OpenSLESPlayer::CreateAudioPlayer() {
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;
SLint32 stream_type = stream_type_;
RETURN_ON_ERROR(
(*player_config)
->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE,