From eb951835fff36e0a3af63ce08b894b59c03502ef Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 17 May 2019 21:53:55 +0200 Subject: [PATCH] player: send MPV_EVENT_TICK during init for the sake of the osc The OSC's (osc.lua) event handling is fundamentally broken. It waits for MPV_EVENT_TICK to update the UI, and MPV_EVENT_TICK has become entirely meaningless, except as a hack for the OSC. There are many situations where the OSC doesn't properly update because the TICK event it expects isn't sent. Fix one of them: it doesn't update the cache state if the VO window is forced and --demuxer-cache-wait is used. Make it so that the tick event is sent even if playback initialization is taking time. This is still slightly broken, because it works only if the mainloop is actually run, which depends on random circumstances (such as moving the mouse over the VO window). The next commit will add another such circumstance which will make it appear to work, although it's still conceptually broken. If we "fixed" it and strictly woke up the player if the idle timer ran out, we'd send tick events all the time, even if nothing is going on, which we don't want. Fucking shitshow. --- player/playloop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/player/playloop.c b/player/playloop.c index 22a9331055..7fcc325c93 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -945,7 +945,10 @@ err: // Potentially needed by some Lua scripts, which assume TICK always comes. static void handle_dummy_ticks(struct MPContext *mpctx) { - if (mpctx->video_status == STATUS_EOF || mpctx->paused) { + if ((mpctx->video_status != STATUS_PLAYING && + mpctx->video_status != STATUS_DRAINING) || + mpctx->paused) + { if (mp_time_sec() - mpctx->last_idle_tick > 0.050) { mpctx->last_idle_tick = mp_time_sec(); mp_notify(mpctx, MPV_EVENT_TICK, NULL);