[Libav-user] reconnect after socket timeout

Atela Wu amankjan at gmail.com
Wed Aug 27 16:05:50 CEST 2014

hi,guys, i’m trying to reconnect the rtmp live stream connection when
socket receives timeout
simply likes
ffplay “rtmp://xxxxxx timeout=5”

but after av_read_frame receiving timeout,  no flag can specify it is eof
or timeout, it returns eof all the time, but it’s fine, whatever i
reconnect to it.

my code is just like this, but after i reopen the io_context,
 av_read_frame will be stucked

ret = av_read_frame(format_ctx, pkt);

if (avio_feof(format_ctx->pb)) {


            avio_open(&format_ctx->pb, filename, AVIO_FLAG_READ) ;

            ic->pb->eof_reached = 0;


            ret = av_read_frame(format_ctx, pkt);


i cannot just call avformat_open_input and avformat_find_stream_info,
because of the format_ctx (including AVstreams, CodecContext) had been
using in other decoding threads.

any  suggestions i will appreciate it .

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140827/20d57d16/attachment.html>

More information about the Libav-user mailing list