ffmpeg_opt: free incorrect priv_data for feed stream
authorLukasz Marek <lukasz.m.luki2@gmail.com>
Fri, 7 Nov 2014 08:05:41 +0000 (09:05 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Nov 2014 01:14:02 +0000 (02:14 +0100)
new_output_stream creates a codec context with arbitraty picked codec.
Later data is updated, but priv_data are left alone.
There is a bit chance there is a mismatch between codecs.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg_opt.c

index 1757dcc..454da98 100644 (file)
@@ -1649,6 +1649,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
         else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
             choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt);
         avcodec_copy_context(ost->enc_ctx, st->codec);
+        if (ost->enc_ctx->priv_data) {
+            av_opt_free(ost->enc_ctx->priv_data);
+            av_freep(&ost->enc_ctx->priv_data);
+        }
     }
 
     avformat_close_input(&ic);