mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/adpcmenc: Round up required buffer size
Otherwise the buffer might be too small. Fixes assert violations when encoding mono audio with exactly one sample. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
c9bd6ee5cb
commit
bffc8f9af1
|
@ -614,7 +614,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_ALP ||
|
||||
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM ||
|
||||
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_WS)
|
||||
pkt_size = (frame->nb_samples * channels) / 2;
|
||||
pkt_size = (frame->nb_samples * channels + 1) / 2;
|
||||
else
|
||||
pkt_size = avctx->block_align;
|
||||
if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
|
||||
|
|
Loading…
Reference in New Issue