[FFmpeg-cvslog] avcodec/libx264: return immediately if encode_nals return 0

Limin Wang git at videolan.org
Fri May 8 02:09:19 EEST 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Sat Apr 18 12:52:48 2020 +0800| [f5e33514e7a879b09fabfeffd78402590225bf47] | committer: Limin Wang

avcodec/libx264: return immediately if encode_nals return 0

x264_encoder_encode can return 0 with nnal 0. As a result, encode_nals will
return 0. In this condition, it's better to return 0 immediately to avoid
the following unneeded pict_type and flags setting.

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

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

 libavcodec/libx264.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index c6cce9ff80..c13e8a58d4 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -447,6 +447,9 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
             return ret;
     } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc));
 
+    if (!ret)
+        return 0;
+
     pkt->pts = pic_out.i_pts;
     pkt->dts = pic_out.i_dts;
 



More information about the ffmpeg-cvslog mailing list