[Libav-user] av_read_frame and tcp streams

Simon Brown simon.k.brown at gmail.com
Wed Nov 3 18:12:23 EET 2021


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
fine.

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?

Regards,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20211103/44fcb66f/attachment.htm>


More information about the Libav-user mailing list