[FFmpeg-devel] [PATCH] avformat/http: support auto reconnect

Lukasz Marek lukasz.m.luki2 at gmail.com
Fri Mar 6 15:46:06 CET 2015


On 6 March 2015 at 11:19, Zhang Rui <bbcallen at gmail.com> wrote:

>      if (!s->hd)
>          return AVERROR_EOF;
> @@ -945,7 +949,19 @@ static int http_read_stream(URLContext *h, uint8_t
> *buf, int size)
>      if (s->compressed)
>          return http_buf_read_compressed(h, buf, size);
>  #endif /* CONFIG_ZLIB */
> -    return http_buf_read(h, buf, size);
> +    read_ret = http_buf_read(h, buf, size);
> +    if (s->reconnect && s->filesize > 0 && s->off < s->filesize &&
> read_ret < 0) {
>

minor: you can chek read_ret < 0 first, this condition usually will net be
meet.


> +        av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRId64".\n",
> s->off);
>

Not sure this should be a warning. maybe info, debug or verbose?


> +        seek_ret = http_seek_internal(h, s->off, SEEK_SET, 1);
> +        if (seek_ret != s->off) {
> +            av_log(h, AV_LOG_WARNING, "Failed to reconnect at
> %"PRId64".\n", s->off);
>

This should be an error I think.


More information about the ffmpeg-devel mailing list