summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-01-01 20:24:24 +0100
committerJanne Grunau <janne-libav@jannau.net>2012-01-02 19:20:23 +0100
commit881a5e047dc78ec9ab771817497dffec503d77ee (patch)
tree0857c45d86537a7efe7c54dcbbe6b2d956b32861 /libavcodec/mpeg12.c
parent264808219d8be93aeda0b6ade8c64898b673f6bc (diff)
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.
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c4
1 files changed, 3 insertions, 1 deletions
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];