diff --git a/libavcodec/decode.c b/libavcodec/decode.c index dccce01402..052f93d82f 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1528,8 +1528,12 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags { int ret; - if (avctx->hw_frames_ctx) - return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); + if (avctx->hw_frames_ctx) { + ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); + frame->width = avctx->coded_width; + frame->height = avctx->coded_height; + return ret; + } if ((ret = update_frame_pool(avctx, frame)) < 0) return ret;