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

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

Issue 2411263003: Android audio playout now supports non-call media streams (Closed)
Patch Set: Adding support for SetCommunicationMode in AudioManager Created 4 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
« no previous file with comments | « webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d675d637e334393694f85f960b1050ee8d94cf6d..b87c5fe5ca74d5a6ec21f795cff2a2c4a1e893d9 100644
--- a/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/webrtc/modules/audio_device/android/opensles_player.cc
@@ -308,6 +308,13 @@ bool OpenSLESPlayer::CreateAudioPlayer() {
// 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;
+ if (!audio_manager_->IsCommunicationModeEnabled()) {
+ // But use STREAM_MUSIC if the user for some reason wants to run in a mode
+ // other than the preferred communication mode.
+ // SL_ANDROID_STREAM_MEDIA <=> android.media.AudioManager.STREAM_MUSIC.
+ stream_type = SL_ANDROID_STREAM_MEDIA;
+ ALOGW("Using non-default stream type SL_ANDROID_STREAM_MEDIA");
+ }
RETURN_ON_ERROR(
(*player_config)
->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE,
« no previous file with comments | « webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698