From 03fec24e192ea1b5c0cf957a5a64c0db9d33e67a Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 16 Sep 2016 14:24:15 +0200 Subject: player: litter code with explicit wakeup calls This does 3 kinds of changes: - change sleeptime=x to mp_set_timeout() - change sleeptime=0 to mp_wakeup_core() calls (to be more explicit) - change commands etc. to call mp_wakeup_core() if they do changes that require the playloop to be rerun This is preparation for the following changes. The goal is to process client API requests without having to rerun the playloop every time. As of this commit, the changes should not change behavior. In particular, the playloop is still implicitly woken up on every command. --- player/video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index e66426f24d..4c56ca1a00 100644 --- a/player/video.c +++ b/player/video.c @@ -706,7 +706,7 @@ static int video_feed_async_filter(struct MPContext *mpctx) if (vf_needs_input(vf) < 1) return 0; - mpctx->sleeptime = 0; // retry until done + mp_wakeup_core(mpctx); // retry until done return video_decode_and_filter(mpctx); } @@ -1376,7 +1376,7 @@ void write_video(struct MPContext *mpctx) if (mpctx->video_status == STATUS_DRAINING) { mpctx->time_frame -= get_relative_time(mpctx); - mpctx->sleeptime = MPMIN(mpctx->sleeptime, mpctx->time_frame); + mp_set_timeout(mpctx, mpctx->time_frame); if (mpctx->time_frame <= 0) { MP_VERBOSE(mpctx, "video EOF reached\n"); mpctx->video_status = STATUS_EOF; @@ -1391,7 +1391,7 @@ void write_video(struct MPContext *mpctx) mpctx->video_status = STATUS_PLAYING; if (r != VD_NEW_FRAME) { - mpctx->sleeptime = 0; // Decode more in next iteration. + mp_wakeup_core(mpctx); // Decode more in next iteration. return; } @@ -1519,7 +1519,7 @@ void write_video(struct MPContext *mpctx) mpctx->max_frames--; } - mpctx->sleeptime = 0; + mp_wakeup_core(mpctx); return; error: @@ -1527,5 +1527,5 @@ error: uninit_video_chain(mpctx); error_on_track(mpctx, track); handle_force_window(mpctx, true); - mpctx->sleeptime = 0; + mp_wakeup_core(mpctx); } -- cgit v1.2.3