diff mbox series

[FFmpeg-devel,25/29] avcodec/snowdec: use ff_frame_new_side_data

Message ID 20240304130657.30631-25-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/29] lavu/opt: factor per-type dispatch out of av_opt_get() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov March 4, 2024, 1:06 p.m. UTC
From: Niklas Haas <git@haasn.dev>

For consistency, even though this cannot be overriden at the packet
level.
---
 libavcodec/snowdec.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 70fbab9a49..97aea748b6 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -787,11 +787,10 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
         res = av_frame_ref(picture, s->mconly_picture);
     if (res >= 0 && s->avmv_index) {
         AVFrameSideData *sd;
-
-        sd = av_frame_new_side_data(picture, AV_FRAME_DATA_MOTION_VECTORS, s->avmv_index * sizeof(AVMotionVector));
-        if (!sd)
-            return AVERROR(ENOMEM);
-        memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector));
+        res = ff_frame_new_side_data(s->avctx, picture, AV_FRAME_DATA_MOTION_VECTORS,
+                                     s->avmv_index * sizeof(AVMotionVector), &sd);
+        if (sd)
+            memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector));
     }
 
     if (res < 0)