avcodec/pthread_frame: Only set PerThreadContext* when frame-threading
Otherwise the thread_ctx pointer might be NULL or point to a SliceThreadContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
1982113467
commit
f9b6e3e48d
@ -644,10 +644,12 @@ void ff_thread_await_progress(const ThreadFrame *f, int n, int field)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ff_thread_finish_setup(AVCodecContext *avctx) {
|
void ff_thread_finish_setup(AVCodecContext *avctx) {
|
||||||
PerThreadContext *p = avctx->internal->thread_ctx;
|
PerThreadContext *p;
|
||||||
|
|
||||||
if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
|
if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
|
||||||
|
|
||||||
|
p = avctx->internal->thread_ctx;
|
||||||
|
|
||||||
p->hwaccel_threadsafe = avctx->hwaccel &&
|
p->hwaccel_threadsafe = avctx->hwaccel &&
|
||||||
(ffhwaccel(avctx->hwaccel)->caps_internal & HWACCEL_CAP_THREAD_SAFE);
|
(ffhwaccel(avctx->hwaccel)->caps_internal & HWACCEL_CAP_THREAD_SAFE);
|
||||||
|
|
||||||
@ -956,11 +958,12 @@ void ff_thread_flush(AVCodecContext *avctx)
|
|||||||
|
|
||||||
int ff_thread_can_start_frame(AVCodecContext *avctx)
|
int ff_thread_can_start_frame(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
PerThreadContext *p = avctx->internal->thread_ctx;
|
if ((avctx->active_thread_type & FF_THREAD_FRAME) &&
|
||||||
|
|
||||||
if ((avctx->active_thread_type&FF_THREAD_FRAME) && atomic_load(&p->state) != STATE_SETTING_UP &&
|
|
||||||
ffcodec(avctx->codec)->update_thread_context) {
|
ffcodec(avctx->codec)->update_thread_context) {
|
||||||
return 0;
|
PerThreadContext *p = avctx->internal->thread_ctx;
|
||||||
|
|
||||||
|
if (atomic_load(&p->state) != STATE_SETTING_UP)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user