aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-07-10 21:23:09 -0700
committerReinhard Tartler <siretart@tauware.de>2011-07-12 18:13:35 +0200
commitdc1b670a2c34a0e1c5c0ba9531dfc8f5a6746a0b (patch)
treec40376228179627918f23701d0c40ff1724bf3e2
parent0156f4f9da2577b32ebbb191047d7ff0ca613c44 (diff)
downloadffmpeg-dc1b670a2c34a0e1c5c0ba9531dfc8f5a6746a0b.tar.gz
vp8/mt: flush worker thread, not application thread context, on seek.
This prevents a crash when seeking. (cherry picked from commit d1cf45911935cc4fed9afd3a37d99616d31eb9da)
-rw-r--r--libavcodec/pthread.c9
-rw-r--r--libavcodec/utils.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 08ef4ba0c2..9fea9a0afc 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -746,9 +746,12 @@ void ff_thread_flush(AVCodecContext *avctx)
if (!avctx->thread_opaque) return;
park_frame_worker_threads(fctx, avctx->thread_count);
-
- if (fctx->prev_thread)
- update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0);
+ if (fctx->prev_thread) {
+ if (fctx->prev_thread != &fctx->threads[0])
+ update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0);
+ if (avctx->codec->flush)
+ avctx->codec->flush(fctx->threads[0].avctx);
+ }
fctx->next_decoding = fctx->next_finished = 0;
fctx->delaying = 1;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c32fda26ec..bbed7263ab 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1058,7 +1058,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
{
if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
ff_thread_flush(avctx);
- if(avctx->codec->flush)
+ else if(avctx->codec->flush)
avctx->codec->flush(avctx);
}