diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-28 20:15:22 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-28 20:15:22 +0200 |
commit | da8c1995056dd6dfb982d612dcd238ae925bd90c (patch) | |
tree | 24b94f8d2d5ee9fcc25b96bc0af515bef416f4d3 | |
parent | 5a0e71a972054f22ae5089228d981a59ae796326 (diff) | |
download | mpv-da8c1995056dd6dfb982d612dcd238ae925bd90c.tar.bz2 mpv-da8c1995056dd6dfb982d612dcd238ae925bd90c.tar.xz |
core: timing: fix overflow with extreme playback speed
With extreme playback speed changes it was possible to trigger an
overflow in code calculating frame timing. This could break the VDPAU
frame scheduling mechanism and lead to the shown picture not changing
until reset by events such as seeking. Add an extra check to prevent
the overflow.
-rw-r--r-- | mplayer.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3422,7 +3422,11 @@ static void run_playloop(struct MPContext *mpctx) mpctx->time_frame += mpctx->video_out->flip_queue_offset; unsigned int t2 = GetTimer(); - unsigned int pts_us = mpctx->last_time + mpctx->time_frame * 1e6; + /* Playing with playback speed it's possible to get pathological + * cases with mpctx->time_frame negative enough to cause an + * overflow in pts_us calculation, thus the FFMAX. */ + double time_frame = FFMAX(mpctx->time_frame, -1); + unsigned int pts_us = mpctx->last_time + time_frame * 1e6; int duration = -1; double pts2 = mpctx->video_out->next_pts2; if (pts2 != MP_NOPTS_VALUE && opts->correct_pts |