diff mbox series

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

Message ID 20211213104726.24998-2-anton@khirnov.net
State Accepted
Commit b780b6db649e693fb1aaebe0da6006a1a5055466
Headers show
Series [FFmpeg-devel,1/2] lavc/encode: improve the empty frame check | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Anton Khirnov Dec. 13, 2021, 10:47 a.m. UTC
It is currently set in encode_simple_internal(), which is only called
for encoders using the "simple" encoding API.
---
 libavcodec/encode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

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;
 }