summaryrefslogtreecommitdiffstats
path: root/player/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-22 11:19:39 +0200
committerwm4 <wm4@nowhere>2015-09-22 11:19:39 +0200
commita75e933dac4c6ebfd15c7c7cc0442fb21318df2a (patch)
tree338a4e9830fd8692eecabf2f3b463b355e21d0c2 /player/video.c
parentab7ac46bcc3bb68cfa3d4dfc920f8bd7143eebe0 (diff)
downloadmpv-a75e933dac4c6ebfd15c7c7cc0442fb21318df2a.tar.bz2
mpv-a75e933dac4c6ebfd15c7c7cc0442fb21318df2a.tar.xz
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.
Diffstat (limited to 'player/video.c')
-rw-r--r--player/video.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/player/video.c b/player/video.c
index de7e601645..97b88de5d2 100644
--- a/player/video.c
+++ b/player/video.c
@@ -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)