This prevents a crash when seeking.
---
libavcodec/pthread.c | 8 +++++---
libavcodec/utils.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index bb8a343..7c5f8fd 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -747,9 +747,11 @@ 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);
+ 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 5ad0c51..32e5251 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1080,7 +1080,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);
}
--
1.7.2.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel