Browse code

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@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cf82c426fadf90105e1fb9d5ecd267cc3aa2b288)

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

Andreas Cadhalpun authored on 2015/03/10 03:24:09
Showing 1 changed files
... ...
@@ -999,6 +999,8 @@ static av_cold int roq_encode_init(AVCodecContext *avctx)
999 999
 
1000 1000
     av_lfg_init(&enc->randctx, 1);
1001 1001
 
1002
+    enc->avctx = avctx;
1003
+
1002 1004
     enc->framesSinceKeyframe = 0;
1003 1005
     if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
1004 1006
         av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n");