lavc/encode: set frame_number for encoders using receive_packet()

It is currently set in encode_simple_internal(), which is only called
for encoders using the "simple" encoding API.
This commit is contained in:
Anton Khirnov 2021-12-13 11:43:16 +01:00
parent 67aceaf4ad
commit b780b6db64

View File

@ -247,11 +247,8 @@ end:
if (ret < 0 || !got_packet) if (ret < 0 || !got_packet)
av_packet_unref(avpkt); av_packet_unref(avpkt);
if (frame) { if (frame)
if (!ret)
avctx->frame_number++;
av_frame_unref(frame); av_frame_unref(frame);
}
if (got_packet) if (got_packet)
// Encoders must always return ref-counted buffers. // Encoders must always return ref-counted buffers.
@ -383,6 +380,8 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame
return ret; return ret;
} }
avctx->frame_number++;
return 0; return 0;
} }