You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/pthread_slice: Return error on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -132,14 +132,16 @@ av_cold int ff_slice_thread_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c));
|
avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c));
|
||||||
|
if (!c)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
mainfunc = ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL;
|
mainfunc = ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL;
|
||||||
if (!c || (thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, mainfunc, thread_count)) <= 1) {
|
thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func,
|
||||||
if (c)
|
mainfunc, thread_count);
|
||||||
avpriv_slicethread_free(&c->thread);
|
if (thread_count <= 1) {
|
||||||
av_freep(&avctx->internal->thread_ctx);
|
ff_slice_thread_free(avctx);
|
||||||
avctx->thread_count = 1;
|
avctx->thread_count = 1;
|
||||||
avctx->active_thread_type = 0;
|
avctx->active_thread_type = 0;
|
||||||
return 0;
|
return thread_count < 0 ? thread_count : 0;
|
||||||
}
|
}
|
||||||
avctx->thread_count = thread_count;
|
avctx->thread_count = thread_count;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user