avcodec/pthread_frame: Add API to share RefStruct refs just once

This is useful when the lifetime of the object to be shared
is the whole decoding process as it allows to avoid having
to sync them every time in update_thread_context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2023-10-09 01:30:00 +02:00
parent 267a763a55
commit 9dc8f8839e
3 changed files with 57 additions and 0 deletions

View File

@@ -1747,6 +1747,13 @@ void ff_progress_frame_await(const ProgressFrame *f, int n)
ff_thread_progress_await(&f->progress->progress, n);
}
#if !HAVE_THREADS
enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset)
{
return FF_THREAD_NO_FRAME_THREADING;
}
#endif /* !HAVE_THREADS */
static av_cold int progress_frame_pool_init_cb(FFRefStructOpaque opaque, void *obj)
{
const AVCodecContext *avctx = opaque.nc;