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

Unified Diff: webrtc/modules/audio_device/android/opensles_player.cc

Issue 1419693004: Fix for "Android audio playout doesn't support non-call media stream" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: nits Created 5 years, 2 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: webrtc/modules/audio_device/android/opensles_player.cc
diff --git a/webrtc/modules/audio_device/android/opensles_player.cc b/webrtc/modules/audio_device/android/opensles_player.cc
index b9ccfd594d36dad0d7b85fbe1f8dbd4f16249f09..113dc70463047c8930b3788930ea18e8bd33a51a 100644
--- a/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/webrtc/modules/audio_device/android/opensles_player.cc
@@ -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 ||
magjed_webrtc 2015/10/28 09:08:33 Maybe add ' << stream_type_' at end of DCHECK so y
henrika_webrtc 2015/10/28 10:48:01 Done.
+ stream_type_ == SL_ANDROID_STREAM_RING ||
+ stream_type_ == SL_ANDROID_STREAM_MEDIA);
// 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,

Powered by Google App Engine
This is Rietveld 408576698