From 976d5045c671700b1e16ed2b98e746a67fa91e8b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 21 Nov 2008 20:27:30 +0100 Subject: decoder: check audio_format_valid() in all decoders Refuse to play audio formats which are not supported by MPD. --- src/decoder/ffmpeg_plugin.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/decoder/ffmpeg_plugin.c') diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 1d98f8051..f9e40e2f5 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -255,6 +255,13 @@ ffmpeg_decode_internal(struct ffmpeg_context *ctx) audio_format.sample_rate = (unsigned int)codec_context->sample_rate; audio_format.channels = codec_context->channels; + if (!audio_format_valid(&audio_format)) { + g_warning("Invalid audio format: %u:%u:%u\n", + audio_format.sample_rate, audio_format.bits, + audio_format.channels); + return false; + } + //there is some problem with this on some demux (mp3 at least) if (format_context->duration != (int)AV_NOPTS_VALUE) { total_time = format_context->duration / AV_TIME_BASE; -- cgit v1.2.3