[Libav-user] av_read_frame and tcp streams

Simon Brown simon.k.brown at gmail.com
Wed Nov 10 18:30:14 EET 2021

On Tue, 9 Nov 2021 at 15:43, Yurii Monakov <monakov.y at gmail.com> wrote:

> You can add "timeout" to the options dictionary (avformat_open_input).
> AVDictionary* opt = 0;
> av_dict_set_int(&opt, "timeout", 1000000);
> avformat_open_input(..., &opt);
> For TCP this will set open/receive timeout to 1 second.
> Best Regards,
> Yurii
> Thank you, i had stimeout set in the dictionary, and have now included
timeout.  But it doesn't actually help:
if the connection is never started, then it aborts, but once started it
doesn't timeout after the connection has been made even if no new data is
being sent.

The real problem is that the server sends data, I receive it and decode
it.  The server stops sending data but maintains the connection.  The
server starts sending data again and the port is still open, but
av_read_frame has blocked, so nothing is done with the data that is sent.
How can I stop av_read_frame from blocking?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20211110/0bad39c4/attachment.htm>

More information about the Libav-user mailing list