1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 12:55:16 +00:00

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).
This commit is contained in:
wm4 2018-04-20 21:24:20 +02:00 committed by Jan Ekström
parent 1c550326ce
commit 205b2da160

View File

@ -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;
}