You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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:
@@ -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_ALP ||
|
||||||
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM ||
|
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM ||
|
||||||
avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_WS)
|
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
|
else
|
||||||
pkt_size = avctx->block_align;
|
pkt_size = avctx->block_align;
|
||||||
if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
|
if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
|
||||||
|
Reference in New Issue
Block a user