summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_libvmaf.c
diff options
context:
space:
mode:
authorKevin Wheatley <kevin.j.wheatley@gmail.com>2018-04-30 16:33:51 +0100
committerJames Almer <jamrial@gmail.com>2018-05-04 18:29:53 -0300
commit51775bc1cdeff04b836422be66e8098146aedcce (patch)
treeae11038247fd66e0ab3cb48684f3ecce8b97217e /libavfilter/vf_libvmaf.c
parent244d4ba0da00b0ea7a3107ba16a983c65b182180 (diff)
downloadffmpeg-streaming-51775bc1cdeff04b836422be66e8098146aedcce.zip
ffmpeg-streaming-51775bc1cdeff04b836422be66e8098146aedcce.tar.gz
avfilter/vf_libvmaf: the libvmaf filter tried to join on an invalid thread id
The thread id was invalid because it was not initialised during the calls to init_complex_filtergraph. This adds a flag to check for initialisation before trying to peform the join. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com>
Diffstat (limited to 'libavfilter/vf_libvmaf.c')
-rw-r--r--libavfilter/vf_libvmaf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 42c6b66..5d47a74 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -43,6 +43,7 @@ typedef struct LIBVMAFContext {
int width;
int height;
double vmaf_score;
+ int vmaf_thread_created;
pthread_t vmaf_thread;
pthread_mutex_t lock;
pthread_cond_t cond;
@@ -228,6 +229,7 @@ static av_cold int init(AVFilterContext *ctx)
s->gmain = av_frame_alloc();
s->error = 0;
+ s->vmaf_thread_created = 0;
pthread_mutex_init(&s->lock, NULL);
pthread_cond_init (&s->cond, NULL);
@@ -275,6 +277,7 @@ static int config_input_ref(AVFilterLink *inlink)
av_log(ctx, AV_LOG_ERROR, "Thread creation failed.\n");
return AVERROR(EINVAL);
}
+ s->vmaf_thread_created = 1;
return 0;
}
@@ -317,7 +320,11 @@ static av_cold void uninit(AVFilterContext *ctx)
pthread_cond_signal(&s->cond);
pthread_mutex_unlock(&s->lock);
- pthread_join(s->vmaf_thread, NULL);
+ if (s->vmaf_thread_created)
+ {
+ pthread_join(s->vmaf_thread, NULL);
+ s->vmaf_thread_created = 0;
+ }
av_frame_free(&s->gref);
av_frame_free(&s->gmain);
OpenPOWER on IntegriCloud