[FFmpeg-devel] [PATCH] lavfi: asetnsamples: fix enlarging fifo
andrey.krieger.utkin at gmail.com
Mon Aug 6 23:33:40 CEST 2012
2012/8/7 Stefano Sabatini <stefasab at gmail.com>:
> This is overallocating the fifo.
> We need to add nb_samples to the fifo, but only FIFO_SPACE <
> nb_samples are available, so we increase the fifo max size to
> FIFO_SIZE + nb_samples.
> We have:
> FIFO_SIZE + FIFO_SPACE = AVAILABLE_SIZE
> FIFO_SPACE = nb_samples
> so it must result:
> FIFO_SIZE + nb_samples = AVAILABLE_SIZE
> What am I missing?
You're missing the fact that av_audio_fifo_size() returns not the full
memory capacity of the object, but the amount of data loaded into it.
The same principle applies to AVFifoBuffer. This is confusing moment
* Get the current number of samples in the AVAudioFifo available for reading.
* @param af the AVAudioFifo to query
* @return number of samples available for reading
int av_audio_fifo_size(AVAudioFifo *af);
More information about the ffmpeg-devel