1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 13:47:04 +00:00

player: fix excessive CPU usage in audio-only mode

Caused by one of the --force-window commits. The unconditional
uninit_video_out() call (which normally should be idempotent) raised
sporadic MPV_EVENT_VIDEO_RECONFIG events. This is ok, except for the
fact that clients (like a Lua script or libmpv users) would cause the
event loop to run again after receiving it, triggering a feedback loop.
Fix it by sending the events really only on a change.
This commit is contained in:
wm4 2015-09-22 11:19:39 +02:00
parent ab7ac46bcc
commit a75e933dac

View File

@ -220,10 +220,11 @@ void reset_video_state(struct MPContext *mpctx)
void uninit_video_out(struct MPContext *mpctx)
{
uninit_video_chain(mpctx);
if (mpctx->video_out)
if (mpctx->video_out) {
vo_destroy(mpctx->video_out);
mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
mpctx->video_out = NULL;
mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
void uninit_video_chain(struct MPContext *mpctx)
@ -236,8 +237,8 @@ void uninit_video_chain(struct MPContext *mpctx)
mpctx->sync_audio_to_video = false;
reselect_demux_streams(mpctx);
remove_deint_filter(mpctx);
mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
int reinit_video_chain(struct MPContext *mpctx)