From 617aff6cdab6484e39cd4074111569e2f5dec9d3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 7 Nov 2015 15:07:23 +0100 Subject: [PATCH] audio: fix af_fmt_change_bytes() with spdif formats This could accidentally change some spdif formats to AAC (because AAC is the first on the list and will match first). spdif formats are inherently uninterchangeable, so treat them as their own class of formats (like int vs. float). Might fix some issues with ao_wasapi.c. --- audio/format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/format.c b/audio/format.c index 100a0f3225..06360b884b 100644 --- a/audio/format.c +++ b/audio/format.c @@ -51,7 +51,7 @@ int af_fmt_change_bytes(int format, int bytes) if (af_fmt_to_bytes(fmt) == bytes && af_fmt_is_float(fmt) == af_fmt_is_float(format) && af_fmt_is_planar(fmt) == af_fmt_is_planar(format) && - af_fmt_is_spdif(fmt) == af_fmt_is_spdif(format)) + (fmt == format || (!af_fmt_is_spdif(fmt) && !af_fmt_is_spdif(format)))) return fmt; } return 0;