From 0b6e3647a504ffd385c424d37575a971eabcb801 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 25 Apr 2010 22:05:59 +0300 Subject: commands: finish seeks before processing other commands The code processing seek commands only sets/alters variables specifying the current seek target. Before all queued commands were processed first, and any needed seeks were executed after that. This was somewhat unreliable, as commands queued later were not guaranteed to see all the effects of earlier seek commands if they happened to be processed in the same batch. Change the behavior so that processing commands is interrupted and the real seek executed if the next command is anything other than a basic seek. This guarantees that other commands see a consistent state, while still allowing the combining of consecutive seeks (which is useful for example when the user keeps the seek-forward key pressed down, and key repeat is faster than seeks can be executed). --- mplayer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 4f309ff6fb..dee01bc0b2 100644 --- a/mplayer.c +++ b/mplayer.c @@ -4309,6 +4309,13 @@ if(auto_quality>0){ mp_cmd_free(cmd); if (mpctx->stop_play) break; + if (mpctx->rel_seek_secs || mpctx->abs_seek_pos) { + cmd = mp_input_get_cmd(mpctx->input, 0, 1); + /* Allow seek commands to be combined, but execute the real seek + * before processing other commands */ + if (!cmd || cmd->id != MP_CMD_SEEK) + break; + } } if (!mpctx->paused || mpctx->stop_play || mpctx->rel_seek_secs || mpctx->abs_seek_pos) -- cgit v1.2.3