[Libav-user] av_read_frame and tcp streams
monakov.y at gmail.com
Tue Nov 9 17:42:46 EET 2021
You can add "timeout" to the options dictionary (avformat_open_input).
AVDictionary* opt = 0;
av_dict_set_int(&opt, "timeout", 1000000);
For TCP this will set open/receive timeout to 1 second.
ср, 3 нояб. 2021 г. в 19:13, Simon Brown <simon.k.brown at gmail.com>:
> I am using av_read_frame to read from an incoming TCP audio stream, that
> was opened by avformat_open_input with ("tcp://127.0.0.1:62011?listen")
> as the source file.
> The server connects to this and sends the data, and av_read_frame returns
> frames of audio data that avcodec_decode_audio4 decodes for me. All is
> Then the server stops sending for a bit, because it's asked to be paused,
> and then a short (or long) time later, it is asked to start again, but
> because the data is from a stream, not a file, the data is actually not a
> continuation of what came before, but essentially starts anew. At this
> point av_read_frame stalls, and never returns a new frame, despite lots of
> data being pushed to it, and the ffmpeg libraries keeping the port open to
> receive the data.
> So my question is a) can I force av_read_frame to return after a timeout,
> so that I can potentially handle a restart? or b) can av_read_frame be
> persuaded to restart itself if it can't synchronize to the incoming data?
> Libav-user mailing list
> Libav-user at ffmpeg.org
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user