aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/av1dec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-08-01 21:02:13 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-08-07 09:50:29 +0200
commitc48cc9c6e90bc8ca0304bd57cb77f7a689f83391 (patch)
tree18436136e82fc12eced8ace1a3d46ecf2589eda0 /libavcodec/av1dec.c
parentdcc1847b18f01ce168266b9067861a8f5b1709b7 (diff)
downloadffmpeg-c48cc9c6e90bc8ca0304bd57cb77f7a689f83391.tar.gz
avcodec/decode: Extend ff_hwaccel_frame_priv_alloc()'s task
All usages of ff_hwaccel_frame_priv_alloc() have the same pattern: Check for whether a hwaccel is in use; check whether it needs private frame-specific data; allocate the AVBuffer and set it. This commit modifies ff_hwaccel_frame_priv_alloc() to perform this task on its own. (It also seems that the H.264 decoder did not perform proper cleanup in case the buffer could not be allocated. This has been changed.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r--libavcodec/av1dec.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index cc178464b9..09339529f7 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -907,17 +907,11 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
break;
}
- if (avctx->hwaccel) {
- const AVHWAccel *hwaccel = avctx->hwaccel;
- if (hwaccel->frame_priv_data_size) {
- f->hwaccel_priv_buf = ff_hwaccel_frame_priv_alloc(avctx, hwaccel);
- if (!f->hwaccel_priv_buf) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
- }
- }
+ ret = ff_hwaccel_frame_priv_alloc(avctx, &f->hwaccel_picture_private,
+ &f->hwaccel_priv_buf);
+ if (ret < 0)
+ goto fail;
+
return 0;
fail: