[FFmpeg-devel] [PATCH] avformat/pcm: decrease delay when reading PCM streams.

Marton Balint cus at passwd.hu
Tue Feb 13 21:09:15 EET 2018


On Tue, 13 Feb 2018, Philipp M. Scholl wrote:

> The blocksize of the PCM decoder is hard-coded. This creates
> unnecessary delay when reading low-rate (<100Hz) streams. This creates
> issues when multiplexing multiple streams, since other inputs are only
> opened/read after a low-rate input block was completely read.
>
> This patch decreases the blocksize for low-rate inputs, so
> approximately a block is read every 10ms. This decreases the startup
> delay when multiplexing inputs with different rates.

Maybe it's just me, but I'd shoot for at least 40 ms instead of 10 ms, too 
small audio frames are ineffective, and some areas of the code limit the 
number of frames in buffers (e.g.: avfilter), or the number of packets in 
queues (e.g.: muxing queue), so having bigger audio frames by default 
makes it less probable for the user to reach these limits and get strange 
errors.

If you really need smaller frames than 40 ms, then I suggest add a tunable 
parameter for the demuxer.

Regards,
Marton


More information about the ffmpeg-devel mailing list