ffmpeg: Fix extradata allocation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/130/head
Michael Niedermayer 10 years ago
parent 20ba28af94
commit 4d02dfbde4
  1. 10
      ffmpeg.c

@ -2684,11 +2684,13 @@ static int transcode_init(void)
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
enc_ctx->field_order = dec_ctx->field_order;
enc_ctx->extradata = av_mallocz(extra_size);
if (!enc_ctx->extradata) {
return AVERROR(ENOMEM);
if (dec_ctx->extradata_size) {
enc_ctx->extradata = av_mallocz(extra_size);
if (!enc_ctx->extradata) {
return AVERROR(ENOMEM);
}
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
}
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
enc_ctx->extradata_size= dec_ctx->extradata_size;
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;

Loading…
Cancel
Save