Hi,

trying to encode roqvideo into asf currently crashes, because enc->avctx is not set in roq_encode_end, which calls:
    av_frame_free(&enc->avctx->coded_frame);

Best regards,
Andreas
>From 4cd715ab02e25948f695c0a4186dab4b864a5ce3 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Mon, 9 Mar 2015 19:24:09 +0100
Subject: [PATCH] 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.cadhal...@googlemail.com>
---
 libavcodec/roqvideoenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index 3215f0a..89879e8 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -999,6 +999,8 @@ static av_cold 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");
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to