diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-27 20:47:08 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-11-01 21:23:03 -0400 |
commit | 50c466d609ec60a324a7a776dfdb57c8d38faa11 (patch) | |
tree | d9bc36b0dbe8fc9d1ac878c16e0d12c060051fd5 /libavcodec/g726.c | |
parent | 9e78d8cfdf915bd8704f544df84402a4b36dfb72 (diff) | |
download | ffmpeg-50c466d609ec60a324a7a776dfdb57c8d38faa11.tar.gz |
g726enc: use av_assert0() for sample_rate validation
This should never happen, but the check avoids a divide-by-zero.
Diffstat (limited to 'libavcodec/g726.c')
-rw-r--r-- | libavcodec/g726.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 12a37e0ab5..ffddf95f20 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <limits.h> +#include "libavutil/avassert.h" #include "avcodec.h" #include "get_bits.h" #include "put_bits.h" @@ -309,10 +310,7 @@ static av_cold int g726_encode_init(AVCodecContext *avctx) "Resample or reduce the compliance level.\n"); return AVERROR(EINVAL); } - if (avctx->sample_rate <= 0) { - av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n"); - return -1; - } + av_assert0(avctx->sample_rate > 0); if(avctx->channels != 1){ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); |