X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fg729_parser.c;h=76d6f938085b22df0fd4302fcb9b847161994385;hb=90262f3fb4afe4b903888e45cc40e2116cb69683;hp=d13c990807af632e29737758ec9e8c394d6af806;hpb=022fa7a24ea8f5000e7b6a50e57cc752f417da47;p=ffmpeg diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c index d13c990807a..76d6f938085 100644 --- a/libavcodec/g729_parser.c +++ b/libavcodec/g729_parser.c @@ -45,12 +45,20 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx, int next; if (!s->block_size) { - av_assert1(avctx->codec_id == AV_CODEC_ID_G729); /* FIXME: replace this heuristic block_size with more precise estimate */ s->block_size = (avctx->bit_rate < 8000) ? G729D_6K4_BLOCK_SIZE : G729_8K_BLOCK_SIZE; + if (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN) + s->block_size++; + s->block_size *= avctx->channels; s->duration = avctx->frame_size; } + if (!s->block_size) { + *poutbuf = buf; + *poutbuf_size = buf_size; + return buf_size; + } + if (!s->remaining) s->remaining = s->block_size; if (s->remaining <= buf_size) { @@ -74,8 +82,8 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx, return next; } -AVCodecParser ff_g729_parser = { - .codec_ids = { AV_CODEC_ID_G729 }, +const AVCodecParser ff_g729_parser = { + .codec_ids = { AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN }, .priv_data_size = sizeof(G729ParseContext), .parser_parse = g729_parse, .parser_close = ff_parse_close,