mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-27 09:52:17 +00:00
avcodec/pthread_slice: Reuse buffer if possible
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
b4ca3c7e4e
commit
571e4055dc
@ -242,9 +242,11 @@ int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count)
|
||||
if (avctx->active_thread_type & FF_THREAD_SLICE) {
|
||||
SliceThreadContext *p = avctx->internal->thread_ctx;
|
||||
|
||||
if (p->entries) {
|
||||
av_freep(&p->entries);
|
||||
if (p->entries_count == count) {
|
||||
memset(p->entries, 0, p->entries_count * sizeof(*p->entries));
|
||||
return 0;
|
||||
}
|
||||
av_freep(&p->entries);
|
||||
|
||||
p->entries = av_calloc(count, sizeof(*p->entries));
|
||||
if (!p->entries) {
|
||||
|
Loading…
Reference in New Issue
Block a user