summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-07 21:04:19 +0200
committerwm4 <wm4@nowhere>2013-07-07 21:10:44 +0200
commit441b684fc8a2899fb41514c339b2d387d04901c9 (patch)
treeb1e1cc989159f90f4c0508e3274efd59c090b85a
parent4caa3356b298116a03ac0509b80dd60eca4017cc (diff)
downloadmpv-441b684fc8a2899fb41514c339b2d387d04901c9.tar.bz2
mpv-441b684fc8a2899fb41514c339b2d387d04901c9.tar.xz
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.
-rw-r--r--stream/stream.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 8aa3a4718e..b2de1221b8 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -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;