diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 59f10f6103..cc6c16ae9b 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -546,7 +546,11 @@ static int control(stream_t *stream, int cmd, void *arg) return STREAM_OK; } case STREAM_CTRL_SEEK_TO_TIME: { - uint64_t tm = (uint64_t) (*((double *)arg) * 90000); + int64_t tm = (int64_t) (*((double *)arg) * 90000); + if (tm < 0) + tm = 0; + if (priv->duration && tm >= (priv->duration * 90)) + tm = priv->duration * 90 - 1; MP_VERBOSE(stream, "seek to PTS %"PRId64"\n", tm); if (dvdnav_time_search(dvdnav, tm) != DVDNAV_STATUS_OK) break;