---
libavcodec/framethread.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/libavcodec/framethread.c b/libavcodec/framethread.c
index 2189291..cb48748 100644
--- a/libavcodec/framethread.c
+++ b/libavcodec/framethread.c
@@ -268,6 +268,19 @@ int ff_frame_thread_init(AVCodecContext *avctx) {
return 0;
}
+static void park_frame_decode_threads(FrameThreadContext *fctx, int thread_count)
+{
+ int i;
+
+ for (i = 0; i < thread_count; i++) {
+ PerThreadContext *p = &fctx->threads[i];
+
+ pthread_mutex_lock(&p->progress_mutex);
+ while (p->state != STATE_INPUT_READY) pthread_cond_wait(&p->output_cond, &p->progress_mutex);
+ pthread_mutex_unlock(&p->progress_mutex);
+ }
+}
+
void ff_frame_thread_free(AVCodecContext *avctx) {
FrameThreadContext *fctx;
AVCodec *codec;
@@ -318,13 +331,7 @@ void ff_frame_thread_flush(AVCodecContext *avctx)
FrameThreadContext *fctx = ((PerThreadContext*)avctx->thread_opaque)->parent;
int i;
- for (i = 0; i < avctx->thread_count; i++) {
- PerThreadContext *p = &fctx->threads[i];
-
- pthread_mutex_lock(&p->progress_mutex);
- while (p->state != STATE_INPUT_READY) pthread_cond_wait(&p->output_cond, &p->progress_mutex);
- pthread_mutex_unlock(&p->progress_mutex);
- }
+ park_frame_decode_threads(fctx, avctx->thread_count);
if (fctx->last_thread != fctx->threads)
avctx->codec->update_context(fctx->threads->context, fctx->last_thread->context);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc