From 881a5e047dc78ec9ab771817497dffec503d77ee Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 1 Jan 2012 20:24:24 +0100 Subject: mpegenc: use avctx->slices as number of slices Adds a new member to MpegEncContext to hold the number of used slice contexts. Fixes segfaults with '-threads 17 -thread_type slice' and fate-vsynth{1,2}-mpeg{2,4}thread{,_ilace} with --disable-pthreads. --- libavcodec/mpeg12.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavcodec/mpeg12.c') diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 48860cf33a..2019512839 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2428,7 +2428,9 @@ static int decode_chunks(AVCodecContext *avctx, } if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) { - int threshold= (s2->mb_height * s->slice_count + avctx->thread_count / 2) / avctx->thread_count; + int threshold = (s2->mb_height * s->slice_count + + s2->slice_context_count / 2) / + s2->slice_context_count; if (threshold <= mb_y) { MpegEncContext *thread_context = s2->thread_context[s->slice_count]; -- cgit v1.2.3