Closed ccsnake closed 3 years ago
@ccsnake , thanks for report. Could you please attach code via code tags in textual format?
According to your question, avformat_find_stream_info()
for most header-less formats like MPEG-TS received via network requires a lot of time.
If you can provide a problematic source, that blocks in some cases call of the findStreamInfo()
, I will debug it and provide a better solution.
thx for your reply.
Code location: https://github.com/h4tr3d/avcpp/blob/fe8847aa740aa4c2868c020c82d6765c8520c1a1/src/formatcontext.cpp#L907
My programe may blocked when i opened a local IPC stream(rtsp) which has bad network. In my case I will open and close stream with fixed interval .
I analyse code. av_find_stream_info()
is a complex function that some times requires so much time for internal work. FormatContext::setTimeout()
useful for simple cases and mainly targeted for use with FormatContext::readPacket()
. For complex cases you should use FormatContext::setInterruptCallback()
. In such way, you can setup some flag, that your callback check and return 1 if findStreamInfo is timed out.
In any case, socketTimeout()
is not a good choose for this option name... Maybe frameReadTimeout() is better.
This will block in some cases.
thx