mirror of https://github.com/mpv-player/mpv
player: cheap hack against idle event feedback loop
The OSC used significant CPU time while the player was paused. It turned out that the "tick" event sent during pause is the problem. The OSC accesses the player core when receiving a tick event, which in turn will cause the core to send another tick event, leading to infinite feedback. Fix this by sending an idle tick only every 500ms. This is not very proper, but the idea behind the tick event isn't very clean to begin with (and the OSC should use timers instead).
This commit is contained in:
parent
4de22d1cbc
commit
8f2ee917d4
|
@ -293,6 +293,7 @@ typedef struct MPContext {
|
|||
|
||||
double last_heartbeat;
|
||||
double last_metadata_update;
|
||||
double last_idle_tick;
|
||||
|
||||
double mouse_timer;
|
||||
unsigned int mouse_event_ts;
|
||||
|
|
|
@ -1183,8 +1183,12 @@ void run_playloop(struct MPContext *mpctx)
|
|||
break;
|
||||
} // video
|
||||
|
||||
if (!video_left || mpctx->paused)
|
||||
mp_notify(mpctx, MPV_EVENT_TICK, NULL);
|
||||
if (!video_left || mpctx->paused) {
|
||||
if (mp_time_sec() - mpctx->last_idle_tick > 0.5) {
|
||||
mpctx->last_idle_tick = mp_time_sec();
|
||||
mp_notify(mpctx, MPV_EVENT_TICK, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
video_left &= mpctx->sync_audio_to_video; // force no-video semantics
|
||||
|
||||
|
|
Loading…
Reference in New Issue