[FFmpeg-cvslog] lavc/encode: set frame_number for encoders using receive_packet()

Anton Khirnov git at videolan.org
Fri Dec 17 11:26:35 EET 2021


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Dec 13 11:43:16 2021 +0100| [b780b6db649e693fb1aaebe0da6006a1a5055466] | committer: Anton Khirnov

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b780b6db649e693fb1aaebe0da6006a1a5055466
---

 libavcodec/encode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 5575cf23db..618be0573d 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -247,11 +247,8 @@ end:
     if (ret < 0 || !got_packet)
         av_packet_unref(avpkt);
 
-    if (frame) {
-        if (!ret)
-            avctx->frame_number++;
+    if (frame)
         av_frame_unref(frame);
-    }
 
     if (got_packet)
         // Encoders must always return ref-counted buffers.
@@ -383,6 +380,8 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame
             return ret;
     }
 
+    avctx->frame_number++;
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list