summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-06 01:13:42 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-10 00:22:15 +0200
commit2a8ac5a780539022b77d80a01ec102dec98df763 (patch)
treeedc517d3ace43058d95bc4c675e30add701e50df
parent22b0141d87e1b0d9c34251c8582bf7e2ab8e2265 (diff)
avcodec/mpegvideo_enc: Don't call av_frame_copy_props() unnecessarily
It is unnecessary in case of user-supplied frames, because it happens directly after a av_frame_ref() with the same src and dst. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpegvideo_enc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9106014aa5..b044fce5cd 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1169,6 +1169,11 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
ret = alloc_picture(s, pic);
if (ret < 0)
return ret;
+ ret = av_frame_copy_props(pic->f, pic_arg);
+ if (ret < 0) {
+ ff_mpeg_unref_picture(s->avctx, pic);
+ return ret;
+ }
for (int i = 0; i < 3; i++) {
int src_stride = pic_arg->linesize[i];
@@ -1210,11 +1215,6 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
}
emms_c();
}
- ret = av_frame_copy_props(pic->f, pic_arg);
- if (ret < 0) {
- ff_mpeg_unref_picture(s->avctx, pic);
- return ret;
- }
pic->display_picture_number = display_picture_number;
pic->f->pts = pts; // we set this here to avoid modifying pic_arg