0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

stream: don't align stream position if not needed

This is pointless, and just increases latency on seeking. For streams
that have a sector size set, this is still needed, though.
This commit is contained in:
wm4 2013-06-06 18:16:57 +02:00
parent df09c1aa63
commit c90ddd4ec1

View File

@ -530,7 +530,6 @@ static int stream_seek_unbuffered(stream_t *s, int64_t newpos)
// Unlike stream_seek_unbuffered(), it still fills the local buffer. // Unlike stream_seek_unbuffered(), it still fills the local buffer.
static int stream_seek_long(stream_t *s, int64_t pos) static int stream_seek_long(stream_t *s, int64_t pos)
{ {
int64_t newpos = 0;
int64_t oldpos = s->pos; int64_t oldpos = s->pos;
s->buf_pos = s->buf_len = 0; s->buf_pos = s->buf_len = 0;
s->eof = 0; s->eof = 0;
@ -541,10 +540,9 @@ static int stream_seek_long(stream_t *s, int64_t pos)
return 1; return 1;
} }
int64_t newpos = pos;
if (s->sector_size) if (s->sector_size)
newpos = (pos / s->sector_size) * s->sector_size; newpos = (pos / s->sector_size) * s->sector_size;
else
newpos = pos & (~((int64_t)STREAM_BUFFER_SIZE - 1));
mp_msg(MSGT_STREAM, MSGL_DBG3, "s->pos=%" PRIX64 " newpos=%" PRIX64 mp_msg(MSGT_STREAM, MSGL_DBG3, "s->pos=%" PRIX64 " newpos=%" PRIX64
" new_bufpos=%" PRIX64 " buflen=%X \n", " new_bufpos=%" PRIX64 " buflen=%X \n",