summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-04-18 12:52:48 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-05-08 06:42:25 +0800
commitf5e33514e7a879b09fabfeffd78402590225bf47 (patch)
tree310084846d71bc6a057a448f862ba19dfd7aa860 /libavcodec/libx264.c
parentd8e98d93485754b746a7d1103f33a30de08022b7 (diff)
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@gmail.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c3
1 files changed, 3 insertions, 0 deletions
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;