@@ -440,16 +440,18 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex
goto fail;
}
- pic->recon_image = av_frame_alloc();
- if (!pic->recon_image) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
+ if (ctx->recon_frames_ref) {
+ pic->recon_image = av_frame_alloc();
+ if (!pic->recon_image) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
- err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0);
- if (err < 0) {
- err = AVERROR(ENOMEM);
- goto fail;
+ err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0);
+ if (err < 0) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
}
pic->priv = av_mallocz(ctx->op->priv_size);