aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mad_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder/mad_plugin.c')
-rw-r--r--src/decoder/mad_plugin.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/decoder/mad_plugin.c b/src/decoder/mad_plugin.c
index d8231014f..da93fe45b 100644
--- a/src/decoder/mad_plugin.c
+++ b/src/decoder/mad_plugin.c
@@ -21,6 +21,7 @@
#include "decoder_api.h"
#include "conf.h"
#include "tag_id3.h"
+#include "audio_check.h"
#include <assert.h>
#include <unistd.h>
@@ -1174,6 +1175,7 @@ static void
mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
{
struct mp3_data data;
+ GError *error = NULL;
struct tag *tag = NULL;
struct replay_gain_info *replay_gain_info = NULL;
struct audio_format audio_format;
@@ -1185,8 +1187,20 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
return;
}
- audio_format_init(&audio_format, data.frame.header.samplerate, 24,
- MAD_NCHANNELS(&data.frame.header));
+ if (!audio_format_init_checked(&audio_format,
+ data.frame.header.samplerate, 24,
+ MAD_NCHANNELS(&data.frame.header),
+ &error)) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+
+ if (tag != NULL)
+ tag_free(tag);
+ if (replay_gain_info != NULL)
+ replay_gain_info_free(replay_gain_info);
+ mp3_data_finish(&data);
+ return;
+ }
decoder_initialized(decoder, &audio_format,
data.input_stream->seekable, data.total_time);