mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user