When hw_base_encode_send_frame() is called with frame == NULL before any frame has been queued, ctx->pic_end is still NULL.
The end-of-stream timestamp fixup dereferences ctx->pic_end unconditionally, so this crashes on flush before the first accepted frame. Guard the fixup so it only runs when pic_end exists. Signed-off-by: Zach Denton <[email protected]> --- libavcodec/hw_base_encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c index 927aeb4bad..2ea93e03e4 100644 --- a/libavcodec/hw_base_encode.c +++ b/libavcodec/hw_base_encode.c @@ -504,7 +504,7 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex // Fix timestamps if we hit end-of-stream before the initial decode // delay has elapsed. - if (ctx->input_order <= ctx->decode_delay) + if (ctx->input_order <= ctx->decode_delay && ctx->pic_end) ctx->dts_pts_diff = ctx->pic_end->pts - ctx->first_pts; } -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
