[Libav-user] Avformat context takes much data before returning data
I am using a AVFormatContext in conjunction with an avio_ctx_buffer to read streaming data into a demuxer.
The source data is received via a socket and injected via the read_packet() calback. When no data is available, I let the callback sleep. I have verified that the data is read by the callback function, so it is available.
My video track is always at the same index so I have no need for searching for streams.
When receiving the AVPackets I deal with them in my own custom functions.
I am basically replacing a flaky homebrewed demuxer with a more standard one.
The problem is that when I start it up, the context reads almost 3MB before it returns the first AVPacket.
I see various topics online on how to reduce the analysis time, but I am unable to reduce mine.