1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avcodec/decode: Only use ff_progress_frame_get_buffer() with blank input

All users (namely HEVC) that use ff_progress_frame_alloc()
should just use ff_thread_get_buffer(). Using
ff_progress_frame_get_buffer() is not a must; it is merely
a convenience wrapper.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-11 11:01:01 +02:00
parent 29b85cd4b8
commit 3b2a9410ef
3 changed files with 10 additions and 17 deletions

View File

@@ -1761,14 +1761,9 @@ int ff_progress_frame_alloc(AVCodecContext *avctx, ProgressFrame *f)
int ff_progress_frame_get_buffer(AVCodecContext *avctx, ProgressFrame *f, int flags)
{
int ret;
check_progress_consistency(f);
if (!f->f) {
ret = ff_progress_frame_alloc(avctx, f);
if (ret < 0)
return ret;
}
int ret = ff_progress_frame_alloc(avctx, f);
if (ret < 0)
return ret;
ret = ff_thread_get_buffer(avctx, f->progress->f, flags);
if (ret < 0) {

View File

@@ -29,6 +29,7 @@
#include "hevc.h"
#include "hevcdec.h"
#include "progressframe.h"
#include "thread.h"
#include "libavutil/refstruct.h"
void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
@@ -157,10 +158,9 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l)
}
}
ret = ff_progress_frame_get_buffer(s->avctx, &frame->tf,
AV_GET_BUFFER_FLAG_REF);
ret = ff_thread_get_buffer(s->avctx, frame->f, AV_GET_BUFFER_FLAG_REF);
if (ret < 0)
return NULL;
goto fail;
frame->rpl = av_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
if (!frame->rpl)

View File

@@ -102,10 +102,9 @@ void ff_progress_frame_report(ProgressFrame *f, int progress);
void ff_progress_frame_await(const ProgressFrame *f, int progress);
/**
* This function allocates ProgressFrame.f
* May be called before ff_progress_frame_get_buffer() in the cases where the
* AVFrame needs to be accessed before the ff_thread_get_buffer() call in
* ff_progress_frame_alloc().
* This function sets up the ProgressFrame, i.e. ProgressFrame.f
* and ProgressFrame.progress. ProgressFrame.f will be blank
* (as if from av_frame_alloc() or av_frame_unref()) on success.
*
* @note: This must only be called by codecs with the
* FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
@@ -113,8 +112,7 @@ void ff_progress_frame_await(const ProgressFrame *f, int progress);
int ff_progress_frame_alloc(struct AVCodecContext *avctx, ProgressFrame *f);
/**
* This function sets up the ProgressFrame, i.e. allocates ProgressFrame.f
* if needed, and also calls ff_thread_get_buffer() on the frame.
* Wrapper around ff_progress_frame_alloc() and ff_thread_get_buffer().
*
* @note: This must only be called by codecs with the
* FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.