aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mlpenc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-04-13 14:07:48 +0200
committerPaul B Mahol <onemda@gmail.com>2022-04-13 14:22:39 +0200
commitf67403edb379ea906cdcaf296977abc894ce2916 (patch)
treec5fc17fe79d32565e311194e7985e7cf92673416 /libavcodec/mlpenc.c
parente663030267851e0e0be54dc9d685fa9cd883cef6 (diff)
downloadffmpeg-f67403edb379ea906cdcaf296977abc894ce2916.tar.gz
avcodec/mlpenc: fix encoding after receiving last frame
This happened when major header needed to be written after input EOF.
Diffstat (limited to 'libavcodec/mlpenc.c')
-rw-r--r--libavcodec/mlpenc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index 0dc0ecf036..52ddec3a21 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -2122,10 +2122,11 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
input_and_return:
- if (frame)
+ if (frame) {
ctx->shorten_by = avctx->frame_size - frame->nb_samples;
- ctx->next_major_frame_size += avctx->frame_size;
- ctx->next_major_number_of_frames++;
+ ctx->next_major_frame_size += avctx->frame_size;
+ ctx->next_major_number_of_frames++;
+ }
if (data)
input_data(ctx, data, frame->nb_samples);
@@ -2166,7 +2167,7 @@ input_and_return:
}
}
- if (!frame)
+ if (!frame && ctx->last_frames < ctx->max_restart_interval - 1)
avctx->frame_number++;
if (bytes_written > 0) {