mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-10-19 18:03:17 +00: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:
parent
29b85cd4b8
commit
3b2a9410ef
3 changed files with 10 additions and 17 deletions
|
@ -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 ff_progress_frame_get_buffer(AVCodecContext *avctx, ProgressFrame *f, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = ff_progress_frame_alloc(avctx, f);
|
||||||
|
if (ret < 0)
|
||||||
check_progress_consistency(f);
|
return ret;
|
||||||
if (!f->f) {
|
|
||||||
ret = ff_progress_frame_alloc(avctx, f);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ff_thread_get_buffer(avctx, f->progress->f, flags);
|
ret = ff_thread_get_buffer(avctx, f->progress->f, flags);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "hevc.h"
|
#include "hevc.h"
|
||||||
#include "hevcdec.h"
|
#include "hevcdec.h"
|
||||||
#include "progressframe.h"
|
#include "progressframe.h"
|
||||||
|
#include "thread.h"
|
||||||
#include "libavutil/refstruct.h"
|
#include "libavutil/refstruct.h"
|
||||||
|
|
||||||
void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
|
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,
|
ret = ff_thread_get_buffer(s->avctx, frame->f, AV_GET_BUFFER_FLAG_REF);
|
||||||
AV_GET_BUFFER_FLAG_REF);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return NULL;
|
goto fail;
|
||||||
|
|
||||||
frame->rpl = av_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
frame->rpl = av_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
||||||
if (!frame->rpl)
|
if (!frame->rpl)
|
||||||
|
|
|
@ -102,10 +102,9 @@ void ff_progress_frame_report(ProgressFrame *f, int progress);
|
||||||
void ff_progress_frame_await(const ProgressFrame *f, int progress);
|
void ff_progress_frame_await(const ProgressFrame *f, int progress);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function allocates ProgressFrame.f
|
* This function sets up the ProgressFrame, i.e. ProgressFrame.f
|
||||||
* May be called before ff_progress_frame_get_buffer() in the cases where the
|
* and ProgressFrame.progress. ProgressFrame.f will be blank
|
||||||
* AVFrame needs to be accessed before the ff_thread_get_buffer() call in
|
* (as if from av_frame_alloc() or av_frame_unref()) on success.
|
||||||
* ff_progress_frame_alloc().
|
|
||||||
*
|
*
|
||||||
* @note: This must only be called by codecs with the
|
* @note: This must only be called by codecs with the
|
||||||
* FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
|
* 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);
|
int ff_progress_frame_alloc(struct AVCodecContext *avctx, ProgressFrame *f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function sets up the ProgressFrame, i.e. allocates ProgressFrame.f
|
* Wrapper around ff_progress_frame_alloc() and ff_thread_get_buffer().
|
||||||
* if needed, and also calls ff_thread_get_buffer() on the frame.
|
|
||||||
*
|
*
|
||||||
* @note: This must only be called by codecs with the
|
* @note: This must only be called by codecs with the
|
||||||
* FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
|
* FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue