Answer the question
In order to leave comments, you need to log in
How to work with libavformat without falling into big delays?
My task is simple: to write a simple audio player with http and rtmp support. The main thing is the minimum delays and work with low bitrates. For such things, the all-in-one set, namely libav*, is a good fit, where working with media data is quite simple. However, I have problems:
1. Lack of support for the ICY protocol, so just ffurl_open () does not call. Not a problem, there is libcurl and then you can parse it with your hands.
2. The parsing of the FLV stream (namely, it is inside RTMP) occurs after loading a decent piece of data (max_analyze_duration will not help here). For low-bitrate streams, 64kb is too much.
At the moment I'm trying to receive data manually (libcurl/librtmp) and feed data via AVIOContext:
AVIOContext *io=avio_alloc_context(buffer, BUFFER_SIZE, 0, NULL, my_byte_reader_callback, NULL, NULL);
context=avformat_alloc_context();
context->pb=io;
...
while(1){
av_read_frame...
}
Answer the question
In order to leave comments, you need to log in
Apparently, it's worth a trite look into the source code and see what and why such a buffer size is formed from. Open source.
why return all 4 megabytes from the callback? Return as many as there are, and then the callback will be called the required number of times.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question