[FFmpeg-cvslog] mpeg12dec: simplify context duplication
Vittorio Giovara
git at videolan.org
Thu Nov 6 18:16:24 CET 2014
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Nov 4 09:36:59 2014 -0500| [5d29efe4b0154ce305d66fed2ac23e5842439256] | committer: Vittorio Giovara
mpeg12dec: simplify context duplication
CC: libav-stable at libav.org
Bug-Id: CID 717453 / CID 717454 / CID 717915
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d29efe4b0154ce305d66fed2ac23e5842439256
---
libavcodec/mpeg12dec.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 38daeaa..b66bdc1 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1138,8 +1138,11 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
if (err)
return err;
- if (!ctx->mpeg_enc_ctx_allocated)
- memcpy(s + 1, s1 + 1, sizeof(Mpeg1Context) - sizeof(MpegEncContext));
+ if (!ctx->mpeg_enc_ctx_allocated) {
+ // copy the whole context after the initial MpegEncContext structure
+ memcpy(ctx, ctx_from, sizeof(*ctx));
+ memset(&ctx->mpeg_enc_ctx, 0, sizeof(ctx->mpeg_enc_ctx));
+ }
if (!(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay))
s->picture_number++;
More information about the ffmpeg-cvslog
mailing list