mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-12 18:25:03 +00:00
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>
This commit is contained in:
parent
6ef4063957
commit
147ee4cf06
@ -880,9 +880,13 @@ void ff_thread_flush(AVCodecContext *avctx)
|
|||||||
fctx->next_decoding = fctx->next_finished = 0;
|
fctx->next_decoding = fctx->next_finished = 0;
|
||||||
fctx->delaying = 1;
|
fctx->delaying = 1;
|
||||||
fctx->prev_thread = NULL;
|
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++) {
|
||||||
for (int i = 0; i < avctx->thread_count; i++)
|
PerThreadContext *p = &fctx->threads[i];
|
||||||
fctx->threads[i].got_frame = 0;
|
// 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)
|
static int *allocate_progress(PerThreadContext *p)
|
||||||
|
Loading…
Reference in New Issue
Block a user