From 3c1c848c2b95489e7aa8b2f7be8b7720f9f317f3 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 25 Feb 2024 15:16:44 +0100 Subject: [PATCH] ao_audiotrack: fix missing check for passthrough support --- audio/out/ao_audiotrack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index 1392699435..c9531a0a66 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -658,6 +658,10 @@ static int init(struct ao *ao) if (af_fmt_is_spdif(ao->format)) { p->format = AudioFormat.ENCODING_IEC61937; + if (!p->format || !AudioTrack.writeShortV23) { + MP_ERR(ao, "spdif passthrough not supported by API\n"); + return -1; + } } else if (ao->format == AF_FORMAT_U8) { p->format = AudioFormat.ENCODING_PCM_8BIT; } else if (p->cfg_pcm_float && af_fmt_is_float(ao->format)) {