[FFmpeg-cvslog] roqvideoenc: set enc->avctx in roq_encode_init

Andreas Cadhalpun git at videolan.org
Fri Mar 13 17:49:07 CET 2015


ffmpeg | branch: release/1.1 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Mon Mar  9 19:24:09 2015 +0100| [e2565069507693280060557d3f2774d6733542ad] | committer: Michael Niedermayer

roqvideoenc: set enc->avctx in roq_encode_init

So far it is only set in roq_encode_frame, but it is used in
roq_encode_end to free the coded_frame. This currently segfaults if
roq_encode_frame is not called between roq_encode_init and
roq_encode_end.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit cf82c426fadf90105e1fb9d5ecd267cc3aa2b288)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2565069507693280060557d3f2774d6733542ad
---

 libavcodec/roqvideoenc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index 02f1a45..0ce11d0 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -942,6 +942,8 @@ static int roq_encode_init(AVCodecContext *avctx)
 
     av_lfg_init(&enc->randctx, 1);
 
+    enc->avctx = avctx;
+
     enc->framesSinceKeyframe = 0;
     if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
         av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n");



More information about the ffmpeg-cvslog mailing list