Browse Source

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>
tags/n2.8
Michael Niedermayer 9 years ago
parent
commit
8992029fc0
1 changed files with 5 additions and 12 deletions
  1. +5
    -12
      libavcodec/g729_parser.c

+ 5
- 12
libavcodec/g729_parser.c View File

@@ -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)


Loading…
Cancel
Save