From 8def7ccb4f252b738f376e2a4ad66ca9c9f1955a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 Dec 2014 16:21:52 +0100 Subject: audio: fix fallback if audio API does not support mono This makes it fallback to stereo properly. --- audio/chmap_sel.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/audio/chmap_sel.c b/audio/chmap_sel.c index 81354422d9..1c5b7919eb 100644 --- a/audio/chmap_sel.c +++ b/audio/chmap_sel.c @@ -184,12 +184,11 @@ bool mp_chmap_sel_adjust(const struct mp_chmap_sel *s, struct mp_chmap *map) } } // Fallback to mono/stereo as last resort - if (map->num == 1) { - *map = (struct mp_chmap) MP_CHMAP_INIT_MONO; - } else if (map->num >= 2) { - *map = (struct mp_chmap) MP_CHMAP_INIT_STEREO; - } - if (test_layout(s, map)) + *map = (struct mp_chmap) MP_CHMAP_INIT_MONO; + if (map->num == 1 && test_layout(s, map)) + return true; + *map = (struct mp_chmap) MP_CHMAP_INIT_STEREO; + if (map->num >= 2 && test_layout(s, map)) return true; *map = (struct mp_chmap) {0}; return false; -- cgit v1.2.3