diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-01-09 20:04:42 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-04-10 16:24:54 +0300 |
commit | 1f4cf92cfbd3accbae582ac63126ed5570ddfd37 (patch) | |
tree | 0d08c281a748689d53350a929fb0df022dc6ef2c /libavcodec/wavpack.c | |
parent | 665e5b0fba41a8bae2269d9ce8929a24002e5907 (diff) |
pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
other threads
- a "fixup" function is called for all the other threads to e.g.
allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r-- | libavcodec/wavpack.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 20884805ab..58ab561a15 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1009,20 +1009,6 @@ static int wv_dsd_reset(WavpackContext *s, int channels) } #if HAVE_THREADS -static int init_thread_copy(AVCodecContext *avctx) -{ - WavpackContext *s = avctx->priv_data; - s->avctx = avctx; - - s->curr_frame.f = av_frame_alloc(); - s->prev_frame.f = av_frame_alloc(); - - if (!s->curr_frame.f || !s->prev_frame.f) - return AVERROR(ENOMEM); - - return 0; -} - static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { WavpackContext *fsrc = src->priv_data; @@ -1714,7 +1700,6 @@ AVCodec ff_wavpack_decoder = { .close = wavpack_decode_end, .decode = wavpack_decode_frame, .flush = wavpack_decode_flush, - .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy), .update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context), .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS, |