X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fhttp.c;h=dfe04ad63af81503fddbcef74b3ce54782bf8d33;hb=1f1c10083352d2d118818b31ec223de8b24fae53;hp=d3c0b7e659dd1921c1995822fb8661a9f8f5eea6;hpb=d5911e6963c0a50cd0ae8d964b08eb128d27b860;p=ffmpeg diff --git a/libavformat/http.c b/libavformat/http.c index d3c0b7e659d..dfe04ad63af 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -399,9 +399,9 @@ static int http_handshake(URLContext *c) switch (ch->handshake_step) { case LOWER_PROTO: av_log(c, AV_LOG_TRACE, "Lower protocol\n"); - if ((ret = ffurl_handshake(cl) > 0)) + if ((ret = ffurl_handshake(cl)) > 0) return 2 + ret; - if ((ret < 0)) + if (ret < 0) return ret; ch->handshake_step = READ_HEADERS; ch->is_connected_server = 1; @@ -1242,7 +1242,7 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size) #endif /* CONFIG_ZLIB */ read_ret = http_buf_read(h, buf, size); if (read_ret < 0 && s->reconnect && !h->is_streamed && s->filesize > 0 && s->off < s->filesize) { - av_log(h, AV_LOG_INFO, "Will reconnect at %"PRId64".\n", s->off); + av_log(h, AV_LOG_INFO, "Will reconnect at %"PRId64" error=%s.\n", s->off, av_err2str(read_ret)); seek_ret = http_seek_internal(h, s->off, SEEK_SET, 1); if (seek_ret != s->off) { av_log(h, AV_LOG_ERROR, "Failed to reconnect at %"PRId64".\n", s->off); @@ -1427,7 +1427,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo ((whence == SEEK_CUR && off == 0) || (whence == SEEK_SET && off == s->off))) return s->off; - else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed) + else if ((s->filesize == -1 && whence == SEEK_END)) return AVERROR(ENOSYS); if (whence == SEEK_CUR) @@ -1440,6 +1440,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo return AVERROR(EINVAL); s->off = off; + if (s->off && h->is_streamed) + return AVERROR(ENOSYS); + /* we save the old context in case the seek fails */ old_buf_size = s->buf_end - s->buf_ptr; memcpy(old_buf, s->buf_ptr, old_buf_size);