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.
This commit is contained in:
wm4 2019-05-17 21:53:55 +02:00
parent f08387c552
commit eb951835ff
1 changed files with 4 additions and 1 deletions

View File

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