avformat/utils: Do not overwrite, but use sample_fmt from context
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 9 Jun 2016 09:22:01 +0000 (11:22 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 9 Jun 2016 17:32:56 +0000 (19:32 +0200)
Fixes Ticket 3759

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index ff52b52..cb8d910 100644 (file)
@@ -3753,6 +3753,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
         /* if no packet was ever seen, update context now for has_codec_parameters */
         if (!st->internal->avctx_inited) {
+            if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
+                st->codecpar->format == AV_SAMPLE_FMT_NONE)
+                st->codecpar->format = st->internal->avctx->sample_fmt;
             ret = avcodec_parameters_to_context(st->internal->avctx, st->codecpar);
             if (ret < 0)
                 goto find_stream_info_err;