[FFmpeg-cvslog] avcodec/pthread: Make sure ff_thread_finish_setup() conditions match
Michael Niedermayer
git at videolan.org
Thu Apr 25 16:11:17 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Apr 25 15:55:01 2013 +0200| [94b3a666fa87f96c4ed2b469bbc28e1ac4e67785] | committer: Michael Niedermayer
avcodec/pthread: Make sure ff_thread_finish_setup() conditions match
Prevents warning from being shown due to multiple calls.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94b3a666fa87f96c4ed2b469bbc28e1ac4e67785
---
libavcodec/pthread.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 1e33fbc..871fb6e 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -362,6 +362,9 @@ static int thread_init(AVCodecContext *avctx)
return 0;
}
+#define THREAD_SAFE_CALLBACKS(avctx) \
+((avctx)->thread_safe_callbacks || (!(avctx)->get_buffer && (avctx)->get_buffer2 == avcodec_default_get_buffer2))
+
/**
* Codec worker thread.
*
@@ -383,11 +386,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
if (fctx->die) break;
- if (!codec->update_thread_context && (avctx->thread_safe_callbacks || (
-#if FF_API_GET_BUFFER
- !avctx->get_buffer &&
-#endif
- avctx->get_buffer2 == avcodec_default_get_buffer2)))
+ if (!codec->update_thread_context && THREAD_SAFE_CALLBACKS(avctx))
ff_thread_finish_setup(avctx);
avcodec_get_frame_defaults(&p->frame);
@@ -1026,7 +1025,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
pthread_mutex_unlock(&p->progress_mutex);
}
- if (!avctx->thread_safe_callbacks && !avctx->codec->update_thread_context)
+ if (!THREAD_SAFE_CALLBACKS(avctx) && !avctx->codec->update_thread_context)
ff_thread_finish_setup(avctx);
if (err)
More information about the ffmpeg-cvslog
mailing list