---
 libavcodec/framethread.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libavcodec/framethread.c b/libavcodec/framethread.c
index 7be5189..a0f80c8 100644
--- a/libavcodec/framethread.c
+++ b/libavcodec/framethread.c
@@ -326,6 +326,9 @@ void ff_frame_thread_flush(AVCodecContext *avctx)
         pthread_mutex_unlock(&p->progress_mutex);
     }
 
+    if (fctx->last_thread != fctx->threads)
+        avctx->codec->update_context(fctx->threads->context, fctx->last_thread->context);
+
     for (i = 0; i < avctx->thread_count; i++) {
         PerThreadContext *p = &fctx->threads[i];
         int j;
@@ -334,10 +337,16 @@ void ff_frame_thread_flush(AVCodecContext *avctx)
             ff_release_buffer(&p->released_buffers[j]);
 
         p->nb_released_buffers = 0;
+
+        memset(&p->result, 0, sizeof(AVFrame));
     }
 
     if (avctx->codec->flush)
-        avctx->codec->flush(fctx->last_thread->context);
+        avctx->codec->flush(fctx->threads->context);
+
+    fctx->next_available = fctx->next_ready = 0;
+    fctx->delaying = 1;
+    fctx->last_thread = NULL;
 }
 
 int ff_get_buffer(AVCodecContext *avctx, AVFrame *f)
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to