avcodec/ffv1enc: avoid repeating the same warning forever

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Jerome Martinez 2025-04-09 00:04:55 +02:00 committed by Michael Niedermayer
parent c818c67991
commit 0c28059b81
No known key found for this signature in database
GPG key ID: B18E8928B3948D64
2 changed files with 6 additions and 1 deletions

View file

@ -151,6 +151,7 @@ typedef struct FFV1Context {
int flt;
int remap_mode;
int remap_optimizer;
int maxsize_warned;
int use32bit;

View file

@ -1749,7 +1749,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
maxsize = ff_ffv1_encode_buffer_size(avctx);
if (maxsize > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32) {
av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
FFV1Context *f = avctx->priv_data;
if (!f->maxsize_warned) {
av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
f->maxsize_warned++;
}
maxsize = INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32;
}