Commit 8562d9bd authored by John Brooks's avatar John Brooks Committed by Janne Grunau

shorten: avoid abort() on unknown audio types

Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent e93947b7
...@@ -176,7 +176,7 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer) ...@@ -176,7 +176,7 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer)
} }
static void init_offset(ShortenContext *s) static int init_offset(ShortenContext *s)
{ {
int32_t mean = 0; int32_t mean = 0;
int chan, i; int chan, i;
...@@ -190,12 +190,13 @@ static void init_offset(ShortenContext *s) ...@@ -190,12 +190,13 @@ static void init_offset(ShortenContext *s)
break; break;
default: default:
av_log(s->avctx, AV_LOG_ERROR, "unknown audio type"); av_log(s->avctx, AV_LOG_ERROR, "unknown audio type");
abort(); return AVERROR_INVALIDDATA;
} }
for (chan = 0; chan < s->channels; chan++) for (chan = 0; chan < s->channels; chan++)
for (i = 0; i < nblock; i++) for (i = 0; i < nblock; i++)
s->offset[chan][i] = mean; s->offset[chan][i] = mean;
return 0;
} }
static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header, static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
...@@ -367,7 +368,8 @@ static int read_header(ShortenContext *s) ...@@ -367,7 +368,8 @@ static int read_header(ShortenContext *s)
if ((ret = allocate_buffers(s)) < 0) if ((ret = allocate_buffers(s)) < 0)
return ret; return ret;
init_offset(s); if ((ret = init_offset(s)) < 0)
return ret;
if (s->version > 1) if (s->version > 1)
s->lpcqoffset = V2LPCQOFFSET; s->lpcqoffset = V2LPCQOFFSET;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment