diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-04 15:57:41 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-10-07 22:34:10 +0200 |
commit | 78c9ed26b6e83ea29b55420c2c88dc1860810042 (patch) | |
tree | 8bf206d6cd9823055339eea31bae4198d00fb027 /libavcodec/pthread_frame.c | |
parent | 9281dcb8011f52f17379789edf67595fa15f8244 (diff) | |
download | ffmpeg-78c9ed26b6e83ea29b55420c2c88dc1860810042.tar.gz |
avcodec/get_buffer: Use RefStruct API for FramePool
Avoids allocations and frees and error checks for said allocations;
also avoids a few indirections and casts.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r-- | libavcodec/pthread_frame.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 138576778d..7e274b0559 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -35,6 +35,7 @@ #include "hwconfig.h" #include "internal.h" #include "pthread_internal.h" +#include "refstruct.h" #include "thread.h" #include "threadframe.h" #include "version_major.h" @@ -329,9 +330,7 @@ FF_ENABLE_DEPRECATION_WARNINGS dst->hwaccel_flags = src->hwaccel_flags; - err = av_buffer_replace(&dst->internal->pool, src->internal->pool); - if (err < 0) - return err; + ff_refstruct_replace(&dst->internal->pool, src->internal->pool); } if (for_user) { @@ -740,7 +739,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) av_freep(&ctx->priv_data); } - av_buffer_unref(&ctx->internal->pool); + ff_refstruct_unref(&ctx->internal->pool); av_packet_free(&ctx->internal->last_pkt_props); av_freep(&ctx->internal); av_buffer_unref(&ctx->hw_frames_ctx); |