1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-12 14:11:10 +02:00

Query in comment (a FIXME) answered. This code is looking at whether we can write an incompletely filled buffer. The missing comment is that additionally, if we're configured to be padding with silence, then yes it is OK.

This commit is contained in:
james.k.crook@gmail.com 2013-08-24 21:42:12 +00:00
parent 6dbcebbde4
commit 435f3751c3

View File

@ -538,10 +538,11 @@ bool ExportFFmpeg::Finalize()
memset(mEncAudioFifoOutBuf,0,nAudioFrameSizeOut); memset(mEncAudioFifoOutBuf,0,nAudioFrameSizeOut);
AVCodec *codec = mEncAudioCodecCtx->codec; AVCodec *codec = mEncAudioCodecCtx->codec;
// We have an incomplete buffer of samples left. Is it OK to encode it?
// If codec supports CODEC_CAP_SMALL_LAST_FRAME, we can feed it with smaller frame // If codec supports CODEC_CAP_SMALL_LAST_FRAME, we can feed it with smaller frame
// If codec is FLAC, feed it anyway (it doesn't have CODEC_CAP_SMALL_LAST_FRAME, but it works) // Or if codec is FLAC, feed it anyway (it doesn't have CODEC_CAP_SMALL_LAST_FRAME, but it works)
// If frame_size is 1, then it's some kind of PCM codec, they don't have frames // Or if frame_size is 1, then it's some kind of PCM codec, they don't have frames and will be fine with the samples
// If user configured the exporter to feed the encoder with silence // FIXME: Finish the sentence! // Or if user configured the exporter to pad with silence, then we'll send audio + silence as a frame.
if ((codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) if ((codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)
|| codec->id == CODEC_ID_FLAC || codec->id == CODEC_ID_FLAC
|| mEncAudioCodecCtx->frame_size == 1 || mEncAudioCodecCtx->frame_size == 1