]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flac_parser.c
imgconvert: fix 2 "discards const qualifier from pointer target type"
[ffmpeg] / libavcodec / flac_parser.c
index 7d3c5c49739b3dcd27fd29087440f1f0c3f8d3b6..52ec1ee683878844b59482def75d5e523f7d7511 100644 (file)
@@ -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,