[FFmpeg-devel] [PATCH] Improve channel count and bitrate error handling in wmav* encode_init()
Michael Niedermayer
michaelni at gmx.at
Mon Mar 21 13:11:45 CET 2011
On Mon, Mar 21, 2011 at 11:23:42AM +0100, Tomas Härdin wrote:
> Hi
>
> The wmav* encoders silently fail if the input has too many channels or
> too low bitrate. The attached patch adds some error logging and better
> return values.
>
> /Tomas
> wmaenc.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
> b0cfbf8949e446c14d59bc27b2bdb79dbe6a1976 0001-Improve-channel-count-and-bitrate-error-handling-in-.patch
> From eda380ca1c8ca5b090cc69ad091d27df6ae9d3bf Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <tomas.hardin at codemill.se>
> Date: Mon, 21 Mar 2011 10:52:36 +0100
> Subject: [PATCH] Improve channel count and bitrate error handling in wmav* encode_init()
>
> ---
> libavcodec/wmaenc.c | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
> index 4e54a70..94ea9bb 100644
> --- a/libavcodec/wmaenc.c
> +++ b/libavcodec/wmaenc.c
> @@ -33,11 +33,17 @@ static int encode_init(AVCodecContext * avctx){
>
> s->avctx = avctx;
>
> - if(avctx->channels > MAX_CHANNELS)
> - return -1;
> + if(avctx->channels > MAX_CHANNELS) {
> + av_log(avctx, AV_LOG_ERROR, "too many channels: got %i, need %i or fewer",
> + avctx->channels, MAX_CHANNELS);
> + return AVERROR(EINVAL);
> + }
ok
>
> - if(avctx->bit_rate < 24*1000)
> - return -1;
> + if(avctx->bit_rate < 24*1000) {
> + av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",
> + avctx->bit_rate);
> + return AVERROR(EINVAL);
> + }
i dont think this is correct, the minimum should depend on chan num & samplerate
i think
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110321/c92e10d4/attachment.asc>
More information about the ffmpeg-devel
mailing list