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 ср, 3 нояб. 2021 г. в 19:13, Simon Brown <[email protected]>: > 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 > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". >
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
