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

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


vlc-android | branch: 3.1.x | Thomas Guillem <thomas at gllm.fr> | Fri Apr  5 09:48:28 2019 +0200| [c8ecf330dd793710780f75fddc1d60fc0dce328c] | 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

(cherry picked from commit f862cf037873b6a8c0e3bc86032a3c2ff5d368ca)

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

 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 6d4588979..c7db77a8f 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