diff options
author | Alexander Strange <astrange@ithinksw.com> | 2011-03-29 17:18:21 -0400 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2011-04-05 16:53:26 +0200 |
commit | ba9ef8d04ecd009036b7c380e71bac081c56c53e (patch) | |
tree | 64992160a7850a4be6ce614caa706ae1a6d852e8 /libavcodec/w32thread.c | |
parent | d6f66edd65992c1275f8e4271be212e1a4808425 (diff) | |
download | ffmpeg-ba9ef8d04ecd009036b7c380e71bac081c56c53e.tar.gz |
Remove unnecessary parameter from ff_thread_init() and fix behavior
thread_count passed to ff_thread_init() is only used to set AVCodecContext.
thread_count, and can be removed. Instead move it to the legacy implementation
of avcodec_thread_init().
This also fixes the problem that calling avcodec_thread_init() with pthreads
enabled did not set it since ff1efc524cb3c60f2f746e3b4550bb1a86c65316.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavcodec/w32thread.c')
-rw-r--r-- | libavcodec/w32thread.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/w32thread.c b/libavcodec/w32thread.c index 27a928e855..023be0e663 100644 --- a/libavcodec/w32thread.c +++ b/libavcodec/w32thread.c @@ -125,7 +125,7 @@ static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext avcodec_thread_execute(s, NULL, arg, ret, count, 0); } -int ff_thread_init(AVCodecContext *s, int thread_count){ +int ff_thread_init(AVCodecContext *s){ int i; ThreadContext *c; uint32_t threadid; @@ -135,14 +135,13 @@ int ff_thread_init(AVCodecContext *s, int thread_count){ return 0; } - s->thread_count= thread_count; s->active_thread_type= FF_THREAD_SLICE; - if (thread_count <= 1) + if (s->thread_count <= 1) return 0; assert(!s->thread_opaque); - c= av_mallocz(sizeof(ThreadContext)*thread_count); + c= av_mallocz(sizeof(ThreadContext)*s->thread_count); s->thread_opaque= c; if(!(c[0].work_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL))) goto fail; @@ -151,7 +150,7 @@ int ff_thread_init(AVCodecContext *s, int thread_count){ if(!(c[0].done_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL))) goto fail; - for(i=0; i<thread_count; i++){ + for(i=0; i<s->thread_count; i++){ //printf("init semaphors %d\n", i); fflush(stdout); c[i].avctx= s; c[i].work_sem = c[0].work_sem; |