summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-03 19:09:22 +0200
committerwm4 <wm4@nowhere>2014-08-03 20:30:34 +0200
commit575314eafa72f7389686bdb85dff4a104a654856 (patch)
tree2ff2c5ab4d99de7b1e25003ae816fc87f57208f6
parent27301ee6918582aa3c6eee54e731d453563663b9 (diff)
downloadmpv-575314eafa72f7389686bdb85dff4a104a654856.tar.bz2
mpv-575314eafa72f7389686bdb85dff4a104a654856.tar.xz
player: allow redrawing screen during seeks
If seeks take very long, it's better not to freeze up the display. (This doesn't handle the case when decoding video frames is extremely slow; just if hr-seek is used, or the demuxer is threaded and blocks on network I/O.)
-rw-r--r--player/playloop.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 564b4e739c..7d3309a583 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -503,16 +503,23 @@ bool mp_seek_chapter(struct MPContext *mpctx, int chapter)
return true;
}
-static bool handle_osd_redraw(struct MPContext *mpctx)
+static void handle_osd_redraw(struct MPContext *mpctx)
{
if (!mpctx->video_out || !mpctx->video_out->config_ok)
- return false;
+ return;
+ // If we're playing normally, let OSD be redrawn naturally as part of
+ // video display.
+ if (mpctx->sleeptime < 0.1 && mpctx->video_status == STATUS_PLAYING)
+ return;
+ // Don't redraw immediately during a seek (makes it significantly slower).
+ if (mp_time_sec() - mpctx->start_timestamp < 0.1)
+ return;
bool want_redraw = vo_get_want_redraw(mpctx->video_out) |
osd_query_and_reset_want_redraw(mpctx->osd);
if (!want_redraw)
- return false;
+ return;
vo_redraw(mpctx->video_out);
- return true;
+ mpctx->sleeptime = 0;
}
static void handle_pause_on_low_cache(struct MPContext *mpctx)
@@ -936,8 +943,7 @@ void run_playloop(struct MPContext *mpctx)
if (mpctx->stop_play)
mpctx->sleeptime = 0;
- if (mpctx->sleeptime > 0 && handle_osd_redraw(mpctx))
- mpctx->sleeptime = 0;
+ handle_osd_redraw(mpctx);
if (mpctx->sleeptime > 0) {
MP_STATS(mpctx, "start sleep");