diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/client.c | 5 | ||||
-rw-r--r-- | player/lua/defaults.lua | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/player/client.c b/player/client.c index fad3d89a93..be8cbc5d88 100644 --- a/player/client.c +++ b/player/client.c @@ -495,6 +495,9 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) { mpv_event *event = ctx->cur_event; + if (timeout < 0) + timeout = 1e20; + int64_t deadline = mp_add_timeout(mp_time_us(), timeout); pthread_mutex_lock(&ctx->lock); @@ -535,7 +538,7 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) } if (ctx->queued_wakeup) break; - if (timeout <= 0) + if (timeout == 0) break; int r = mpthread_cond_timedwait(&ctx->wakeup, &ctx->lock, deadline); if (r == ETIMEDOUT) diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua index c264175768..37c05dea92 100644 --- a/player/lua/defaults.lua +++ b/player/lua/defaults.lua @@ -360,7 +360,7 @@ function mp.dispatch_events(allow_wait) if wait == nil then wait = 1e20 -- infinity for all practical purposes end - if more_events then + if more_events or wait < 0 then wait = 0 end -- Resume playloop - important especially if an error happened while |