flac: only set channel layout if not previously set or on channel count change

Fixes Bug 402
This commit is contained in:
Justin Ruggles 2012-12-16 11:02:39 -05:00
parent 9378be9f32
commit aef5150719
2 changed files with 7 additions and 3 deletions

View File

@ -457,9 +457,12 @@ static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf,
check_header_mismatch(fpc, header, child, 0);
}
fpc->avctx->sample_rate = header->fi.samplerate;
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->pc->duration = header->fi.blocksize;
*poutbuf = flac_fifo_read_wrap(fpc, header->offset, *poutbuf_size,
&fpc->wrap_buf,

View File

@ -426,6 +426,7 @@ static int decode_frame(FLACContext *s)
return ret;
}
s->channels = s->avctx->channels = fi.channels;
if (!s->avctx->channel_layout && s->channels <= 6)
ff_flac_set_channel_layout(s->avctx);
s->ch_mode = fi.ch_mode;