[Android] MediaPlayer: don't try multi channels PCM by default

Thomas Guillem git at videolan.org
Fri Apr 5 10:12:31 CEST 2019


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Apr  5 09:48:28 2019 +0200| [f862cf037873b6a8c0e3bc86032a3c2ff5d368ca] | committer: Thomas Guillem

MediaPlayer: don't try multi channels PCM by default

AudioTrack will say it support multi channels but it will just cut every
channels after 2.0. That's why we could not hear the voice with some medias on
some devices (Nexus 6p, Chrome book).

Fixes #800

> https://code.videolan.org/videolan/vlc-android/commit/f862cf037873b6a8c0e3bc86032a3c2ff5d368ca
---

 libvlc/src/org/videolan/libvlc/MediaPlayer.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index a61d2c74f..e192772c0 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -504,7 +504,10 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
                 for (int i = 0; i < mEncodedDevices.size(); ++i)
                     encodingFlags |= mEncodedDevices.valueAt(i);
 
-                updateAudioOutputDevice(encodingFlags, "pcm");
+                /* Very simple assumption: force stereo PCM if the audio device doesn't support
+                 * any encoded codecs. */
+                final String defaultDevice = encodingFlags == 0 ? "stereo" : "pcm";
+                updateAudioOutputDevice(encodingFlags, defaultDevice);
             }
 
             @RequiresApi(Build.VERSION_CODES.M)



More information about the Android mailing list