X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fg729dec.c;h=25951716eff9c47b6bc6d018b2c9e1769d6fa20a;hb=5e546864b09379910721b35a14713982d933d9dd;hp=2e4756b805738890ad85ee87ceaf1842a07f6f1b;hpb=5c363d3e595a9e5b7c42897b7aab91b91b154ac1;p=ffmpeg diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 2e4756b8057..25951716eff 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -424,7 +424,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - if (buf_size % (G729_8K_BLOCK_SIZE * avctx->channels) == 0) { + if (buf_size % ((G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels) == 0) { packet_type = FORMAT_G729_8K; format = &format_g729_8k; //Reset voice decision @@ -445,6 +445,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, int bad_pitch = 0; ///< parity check failed int is_periodic = 0; ///< whether one of the subframes is declared as periodic or not out_frame = (int16_t*)frame->data[c]; + if (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN) { + if (*buf != ((avctx->channels - 1 - c) * 0x80 | 2)) + avpriv_request_sample(avctx, "First byte value %x for channel %d", *buf, c); + buf++; + } for (i = 0; i < buf_size; i++) frame_erasure |= buf[i]; @@ -727,7 +732,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, } *got_frame_ptr = 1; - return packet_type == FORMAT_G729_8K ? G729_8K_BLOCK_SIZE * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels; + return packet_type == FORMAT_G729_8K ? (G729_8K_BLOCK_SIZE + (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)) * avctx->channels : G729D_6K4_BLOCK_SIZE * avctx->channels; } static av_cold int decode_close(AVCodecContext *avctx) @@ -749,3 +754,15 @@ AVCodec ff_g729_decoder = { .close = decode_close, .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, }; + +AVCodec ff_acelp_kelvin_decoder = { + .name = "acelp.kelvin", + .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"), + .type = AVMEDIA_TYPE_AUDIO, + .id = AV_CODEC_ID_ACELP_KELVIN, + .priv_data_size = sizeof(G729Context), + .init = decoder_init, + .decode = decode_frame, + .close = decode_close, + .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, +};