aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/ffmpeg_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-11-28 11:56:01 +0100
committerMax Kellermann <max@duempel.org>2011-11-28 11:56:01 +0100
commit4f093d5b979c3547c8dd8045dde5d91e8cc93461 (patch)
tree94b1c12cfce14c90f26852e948ba419a8a7ba7eb /src/decoder/ffmpeg_decoder_plugin.c
parent37420c342bf9582a0de32d46f78716e913119400 (diff)
parente1b032cbad5db7698104a93c2235fb7da1f8b580 (diff)
downloadmpd-4f093d5b979c3547c8dd8045dde5d91e8cc93461.tar.gz
mpd-4f093d5b979c3547c8dd8045dde5d91e8cc93461.tar.xz
mpd-4f093d5b979c3547c8dd8045dde5d91e8cc93461.zip
Merge branch 'v0.16.x'
Conflicts: Makefile.am NEWS configure.ac src/encoder/flac_encoder.c src/log.c src/pcm_buffer.c
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_decoder_plugin.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c
index 2923c1400..14727715b 100644
--- a/src/decoder/ffmpeg_decoder_plugin.c
+++ b/src/decoder/ffmpeg_decoder_plugin.c
@@ -400,13 +400,6 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
return;
}
- if (avcodec_open(codec_context, codec)<0) {
- g_warning("Could not open codec\n");
- av_close_input_stream(format_context);
- mpd_ffmpeg_stream_close(stream);
- return;
- }
-
GError *error = NULL;
struct audio_format audio_format;
if (!audio_format_init_checked(&audio_format,
@@ -415,7 +408,18 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
codec_context->channels, &error)) {
g_warning("%s", error->message);
g_error_free(error);
- avcodec_close(codec_context);
+ av_close_input_stream(format_context);
+ mpd_ffmpeg_stream_close(stream);
+ return;
+ }
+
+ /* the audio format must be read from AVCodecContext by now,
+ because avcodec_open() has been demonstrated to fill bogus
+ values into AVCodecContext.channels - a change that will be
+ reverted later by avcodec_decode_audio3() */
+
+ if (avcodec_open(codec_context, codec)<0) {
+ g_warning("Could not open codec\n");
av_close_input_stream(format_context);
mpd_ffmpeg_stream_close(stream);
return;