mirror of https://github.com/mpv-player/mpv
stream: don't treat position 0 specially
Seeking to position 0 meant to try reconnecting with some streams, actually just the internal http implementation. This has been removed, so we don't need the special handling anymore. This means we don't have to be stuck in a retry loop if the stream doesn't even support reconnect.
This commit is contained in:
parent
4caa3356b2
commit
441b684fc8
|
@ -288,12 +288,11 @@ static int stream_reconnect(stream_t *s)
|
|||
s->pos = 0;
|
||||
s->buf_pos = s->buf_len = 0;
|
||||
|
||||
// Some streams (internal http.c) don't support STREAM_CTRL_RECONNECT,
|
||||
// but do it when trying to seek.
|
||||
if (s->control) {
|
||||
if (s->control(s, STREAM_CTRL_RECONNECT, NULL) == STREAM_ERROR)
|
||||
continue;
|
||||
}
|
||||
int r = stream_control(s, STREAM_CTRL_RECONNECT, NULL);
|
||||
if (r == STREAM_UNSUPPORTED)
|
||||
return 0;
|
||||
if (r != STREAM_OK)
|
||||
continue;
|
||||
|
||||
if (stream_seek_unbuffered(s, pos) < 0 && s->pos == pos)
|
||||
return 1;
|
||||
|
@ -470,7 +469,7 @@ int stream_write_buffer(stream_t *s, unsigned char *buf, int len)
|
|||
// Seek function bypassing the local stream buffer.
|
||||
static int stream_seek_unbuffered(stream_t *s, int64_t newpos)
|
||||
{
|
||||
if (newpos == 0 || newpos != s->pos) {
|
||||
if (newpos != s->pos) {
|
||||
if (!s->seek || !(s->flags & MP_STREAM_SEEK)) {
|
||||
mp_tmsg(MSGT_STREAM, MSGL_ERR, "Can not seek in this stream\n");
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue