summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-03-17 10:59:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-19 02:25:46 +0100
commit97f8c6e14753b94c1f6a96fe354a125bbfdea2cb (patch)
tree4478b12d274c847216145e1fb0af922e768edbf7 /libavcodec/pthread.c
parent55bb8f4589a430d9a2126061dfcffa8c37fb1dde (diff)
pthread: update all get_buffer checks for get_buffer2
This restores the performance of simple frame-threaded codecs back to their pre-merge levels. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 799644ff43..b32d70744a 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -376,7 +376,11 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
if (fctx->die) break;
- if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer))
+ 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)))
ff_thread_finish_setup(avctx);
avcodec_get_frame_defaults(&p->frame);
@@ -933,8 +937,11 @@ int ff_thread_can_start_frame(AVCodecContext *avctx)
{
PerThreadContext *p = avctx->thread_opaque;
if ((avctx->active_thread_type&FF_THREAD_FRAME) && p->state != STATE_SETTING_UP &&
- (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks &&
- avctx->get_buffer != avcodec_default_get_buffer))) {
+ (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && (
+#if FF_API_GET_BUFFER
+ avctx->get_buffer ||
+#endif
+ avctx->get_buffer2 != avcodec_default_get_buffer2)))) {
return 0;
}
return 1;
@@ -953,8 +960,11 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
return ff_get_buffer(avctx, f->f, flags);
if (p->state != STATE_SETTING_UP &&
- (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks &&
- avctx->get_buffer != avcodec_default_get_buffer))) {
+ (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && (
+#if FF_API_GET_BUFFER
+ avctx->get_buffer ||
+#endif
+ avctx->get_buffer2 != avcodec_default_get_buffer2)))) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
return -1;
}