aboutsummaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer2014-09-06 04:42:48 +0200
committerMichael Niedermayer2014-09-07 03:13:44 +0200
commitab84effdeda931a74d8503891488ed538619a5d3 (patch)
tree8f436fc784ab2021980df0e0488a3201d0892dcf /ffmpeg.c
parent033a5334badd8af48f13c6fd1e6827f8e3f2c2f3 (diff)
ffmpeg: Copy extradata if it has been initialized later from the encoder
Fixes Ticket3909 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 220816b851..0807eec0b6 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -590,6 +590,14 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
AVCodecContext *avctx = ost->st->codec;
int ret;
+ if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
+ ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (ost->st->codec->extradata) {
+ memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size);
+ ost->st->codec->extradata_size = ost->enc_ctx->extradata_size;
+ }
+ }
+
if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||
(avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
pkt->pts = pkt->dts = AV_NOPTS_VALUE;