From 205b2da160d4941ebf2b55b1f72b9bca60d24aab Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 20 Apr 2018 21:24:20 +0200 Subject: vo_libmpv: move some update() callbacks out of context lock update() used to require the lock, but now it doesn't matter. It's slightly better to do it outside of the lock now, in case the update callback reschedules before returning, and the user render thread tries to acquire the still held lock (which would require 2 more context switches). --- video/out/vo_libmpv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video/out/vo_libmpv.c b/video/out/vo_libmpv.c index 778de778f5..1501a3d244 100644 --- a/video/out/vo_libmpv.c +++ b/video/out/vo_libmpv.c @@ -525,8 +525,8 @@ static int control(struct vo *vo, uint32_t request, void *data) pthread_mutex_lock(&p->ctx->lock); forget_frames(p->ctx, false); p->ctx->need_reset = true; - update(p->ctx); pthread_mutex_unlock(&p->ctx->lock); + update(p->ctx); return VO_TRUE; case VOCTRL_PAUSE: vo->want_redraw = true; @@ -537,14 +537,14 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_SET_PANSCAN: pthread_mutex_lock(&p->ctx->lock); p->ctx->need_resize = true; - update(p->ctx); pthread_mutex_unlock(&p->ctx->lock); + update(p->ctx); return VO_TRUE; case VOCTRL_UPDATE_RENDER_OPTS: pthread_mutex_lock(&p->ctx->lock); p->ctx->need_update_external = true; - update(p->ctx); pthread_mutex_unlock(&p->ctx->lock); + update(p->ctx); return VO_TRUE; } -- cgit v1.2.3