aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/flac_parser.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-12-16 11:02:39 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-12-22 01:35:28 -0500
commitaef5150719f03ce87e67c17d2006e24d8961aa17 (patch)
tree8ac0aef0807bf331b17647f17dae5cfe864b4e0f /libavcodec/flac_parser.c
parent9378be9f3252bfa6970405c235c776df3f75533a (diff)
downloadffmpeg-aef5150719f03ce87e67c17d2006e24d8961aa17.tar.gz
flac: only set channel layout if not previously set or on channel count change
Fixes Bug 402
Diffstat (limited to 'libavcodec/flac_parser.c')
-rw-r--r--libavcodec/flac_parser.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index f0a37f310e..3d8e17f995 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -457,9 +457,12 @@ static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf,
check_header_mismatch(fpc, header, child, 0);
}
+ if (header->fi.channels != fpc->avctx->channels ||
+ (!fpc->avctx->channel_layout && header->fi.channels <= 6)) {
+ fpc->avctx->channels = header->fi.channels;
+ ff_flac_set_channel_layout(fpc->avctx);
+ }
fpc->avctx->sample_rate = header->fi.samplerate;
- fpc->avctx->channels = header->fi.channels;
- ff_flac_set_channel_layout(fpc->avctx);
fpc->pc->duration = header->fi.blocksize;
*poutbuf = flac_fifo_read_wrap(fpc, header->offset, *poutbuf_size,
&fpc->wrap_buf,