summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2012-03-24 18:25:15 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2012-03-24 15:29:51 -0700
commit147ee4cf065a20bbba10292b496a037e6573cd6e (patch)
treea8c05dbca176e23e9939bfe3c41a46f1bd70a161 /libavcodec/pthread.c
parent6ef4063957aa5025c8d2cd757b6a537e4b6874df (diff)
pthread: Immediately release all frames in ff_thread_flush()
Before this, they were only added to the delayed release queue and not freed until later. This could lead to unnecessary memory use or buffer exhaustion. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 2a11195e78..ee7bdb5310 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -880,9 +880,13 @@ void ff_thread_flush(AVCodecContext *avctx)
fctx->next_decoding = fctx->next_finished = 0;
fctx->delaying = 1;
fctx->prev_thread = NULL;
- // Make sure decode flush calls with size=0 won't return old frames
- for (int i = 0; i < avctx->thread_count; i++)
- fctx->threads[i].got_frame = 0;
+ for (int i = 0; i < avctx->thread_count; i++) {
+ PerThreadContext *p = &fctx->threads[i];
+ // Make sure decode flush calls with size=0 won't return old frames
+ p->got_frame = 0;
+
+ release_delayed_buffers(p);
+ }
}
static int *allocate_progress(PerThreadContext *p)