From 4a65c22c500b9c6c96e7578babffcec0c78ef948 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 8 Jan 2020 02:31:18 +0100 Subject: osd: fix possible misses of osd-dimensions property updates check_obj_resize() in sub/osd.c calls mp_client_broadcast_event(), which calls notify_property_events(). This is pretty unexpected, because check_obj_resize() may be called from the VO thread. While that's sort of awful, it seems to be OK locking-wise. But it breaks an assumption in notify_property_events() that the core doesn't need to be woken up, which could possibly lead to a missed/delayed property update (although rather unlikely). Fix this by explicitly waking up the core when it's called from the OSD code. --- player/client.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'player/client.c') diff --git a/player/client.c b/player/client.c index 97e43a15ce..6e454db34b 100644 --- a/player/client.c +++ b/player/client.c @@ -779,6 +779,17 @@ void mp_client_broadcast_event(struct MPContext *mpctx, int event, void *data) pthread_mutex_unlock(&clients->lock); } +// Like mp_client_broadcast_event(), but can be called from any thread. +// Avoid using this. +void mp_client_broadcast_event_external(struct mp_client_api *api, int event, + void *data) +{ + struct MPContext *mpctx = api->mpctx; + + mp_client_broadcast_event(mpctx, event, data); + mp_wakeup_core(mpctx); +} + // If client_name == NULL, then broadcast and free the event. int mp_client_send_event(struct MPContext *mpctx, const char *client_name, uint64_t reply_userdata, int event, void *data) -- cgit v1.2.3