[FFmpeg-devel] [PATCH] avformat/http: support auto reconnect
Zhang Rui
bbcallen at gmail.com
Mon Mar 9 03:45:51 CET 2015
>> + { "reconnect", "auto reconnect after disconnect before EOF", OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
>
> The default of this setting is probably worth a discussion.
The default value is not my concern,
So I make the default behavior remain unchanged.
May I have your suggestion?
>> + read_ret = http_buf_read(h, buf, size);
>> + if (s->reconnect && s->filesize > 0 && s->off < s->filesize && read_ret < 0) {
>
> Maybe it should check is_streamed (seekability) too?
I'll fix it.
>> + av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRId64".\n", s->off);
>> + 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);
>> + return read_ret;
>
> Not sure if it should return read_ret or seek_ret...
read() returns the bytes received, while seek() returns the offset it seeked to,
which could be different from the request offset. (at least, no
document guarantee)
And I doubt if seek() could returns AVERROR_EOF.
Whatever, it is read() which causes http_read() failure, but not seek().
> In generals looks sane to me.
Thanks for your review.
More information about the ffmpeg-devel
mailing list