summaryrefslogtreecommitdiffstats
path: root/libavcodec/g729_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-11 22:53:36 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-11 23:16:35 +0200
commit8992029fc0a4dd9df16f8cb46cfb641c98fc9f6c (patch)
tree459459e0f67d2d1bc3d43ea346103891725d4327 /libavcodec/g729_parser.c
parent0581ab2cacccb96740ef246972f12d7a34f1cc0f (diff)
downloadffmpeg-streaming-8992029fc0a4dd9df16f8cb46cfb641c98fc9f6c.zip
ffmpeg-streaming-8992029fc0a4dd9df16f8cb46cfb641c98fc9f6c.tar.gz
avcodec/g729_parser: Replace codec_id check by assert
A parser should never be called with a mismatching codec Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/g729_parser.c')
-rw-r--r--libavcodec/g729_parser.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index 65e97a9..d13c990 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -25,6 +25,7 @@
* Splits packets into individual blocks.
*/
+#include "libavutil/avassert.h"
#include "parser.h"
#include "g729.h"
@@ -44,18 +45,10 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
int next;
if (!s->block_size) {
- switch (avctx->codec_id) {
- case 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;
- s->duration = avctx->frame_size;
- break;
- default:
- *poutbuf = buf;
- *poutbuf_size = buf_size;
- av_log(avctx, AV_LOG_ERROR, "Invalid codec_id\n");
- return buf_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;
+ s->duration = avctx->frame_size;
}
if (!s->remaining)
OpenPOWER on IntegriCloud