[vlc-commits] ALSA: only set channels that are actually mapped (fixes #8934)

Rémi Denis-Courmont git at videolan.org
Wed Jul 10 22:26:27 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 10 23:24:47 2013 +0300| [d3a43ec88f34eca9c59151c076bb7226a9db5d8c] | committer: Rémi Denis-Courmont

ALSA: only set channels that are actually mapped (fixes #8934)

The code failed to clear unmapped channels present in the input.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3a43ec88f34eca9c59151c076bb7226a9db5d8c
---

 modules/audio_output/alsa.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 350d509..9a231aa 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -207,19 +207,21 @@ static int Map2Mask (vlc_object_t *obj, const snd_pcm_chmap_t *restrict map)
  * Compares a fixed ALSA channels map with the VLC channels order.
  */
 static unsigned SetupChannelsFixed(const snd_pcm_chmap_t *restrict map,
-                                uint16_t *restrict mask, uint8_t *restrict tab)
+                               uint16_t *restrict maskp, uint8_t *restrict tab)
 {
     uint32_t chans_out[AOUT_CHAN_MAX];
+    uint16_t mask = 0;
 
     for (unsigned i = 0; i < map->channels; i++)
     {
         uint_fast16_t vlc_chan = vlc_chans[map->pos[i]];
 
         chans_out[i] = vlc_chan;
-        *mask |= vlc_chan;
+        mask |= vlc_chan;
     }
 
-    return aout_CheckChannelReorder(NULL, chans_out, *mask, tab);
+    *maskp = mask;
+    return aout_CheckChannelReorder(NULL, chans_out, mask, tab);
 }
 
 /**



More information about the vlc-commits mailing list