From 1f4cf92cfbd3accbae582ac63126ed5570ddfd37 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 9 Jan 2017 18:04:42 +0100 Subject: 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). --- libavcodec/alac.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'libavcodec/alac.c') diff --git a/libavcodec/alac.c b/libavcodec/alac.c index ea5ab182f9..c8c04223a0 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -601,15 +601,6 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) return 0; } -#if HAVE_THREADS -static int init_thread_copy(AVCodecContext *avctx) -{ - ALACContext *alac = avctx->priv_data; - alac->avctx = avctx; - return allocate_buffers(alac); -} -#endif - static const AVOption options[] = { { "extra_bits_bug", "Force non-standard decoding process", offsetof(ALACContext, extra_bit_bug), AV_OPT_TYPE_BOOL, { .i64 = 0 }, @@ -633,7 +624,6 @@ AVCodec ff_alac_decoder = { .init = alac_decode_init, .close = alac_decode_close, .decode = alac_decode_frame, - .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy), .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, .priv_class = &alac_class }; -- cgit v1.2.3