[FFmpeg-devel] [PATCH] Description of avcodec_encode_audio()

John Fletcher john.fletcher
Thu Apr 2 22:15:29 CEST 2009

> "pcm" there is nothing pcm specific

It is different for PCM because in that case buf_size
determines the number of samples to be encoded, as explained
in the current description of the function:

 * @param[in] samples the input buffer containing the samples
 * The number of samples read from this buffer is frame_size*channels,
 * both of which are defined in \p avctx.
 * For PCM audio the number of samples read from \p samples is equal to
 * \p buf_size * input_sample_size / output_sample_size.

This is the whole problem.  You can't set buffer to be FF_MIN_BUFFER_SIZE
in case of PCM, or more strictly, you can't set buf_size to be that value.
This is why I asked about actual size vs. buf_size.

In fact I'm not even sure that the comment about number of PCM samples is
correct.  You can see from the case input_sample_size == output_sample_size,
that the expression gives number of bytes read, not the number of samples.


More information about the ffmpeg-devel mailing list