diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 0af685e28bdad7e647ae161d95e1a29702f8c272..429d9a518a8649ce9598ba4a48b5be932d326602 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -406,7 +406,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     *picture = ctx->picture;
     *got_frame = 1;
-    return buf_size;
+    return avpkt->size;
 }
 
 static av_cold int dnxhd_decode_close(AVCodecContext *avctx)