History

avcodec/pthread_slice: Return error on error

Andreas Rheinhardt committed 1 year ago

Commit 7d1bf0a1 parent c82101c1 file · +7 −5Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/pthread_slice.c+7−5
@@ -132,14 +132,16 @@ av_cold int ff_slice_thread_init(AVCodecContext *avctx) · 131 unmodified lines
132132 }
133133
134134 avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c));
135+ if (!c)
136+ return AVERROR(ENOMEM);
135137 mainfunc = ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL;
136− if (!c || (thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, mainfunc, thread_count)) <= 1) {
137− if (c)
138− avpriv_slicethread_free(&c->thread);
139− av_freep(&avctx->internal->thread_ctx);
138+ thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func,
139+ mainfunc, thread_count);
140+ if (thread_count <= 1) {
141+ ff_slice_thread_free(avctx);
140142 avctx->thread_count = 1;
141143 avctx->active_thread_type = 0;
142− return 0;
144+ return thread_count < 0 ? thread_count : 0;
143145 }
144146 avctx->thread_count = thread_count;
145147

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t