af: fix crash on invalid channel count

Sanitize channel count for libaf to avoid crashes since it is used unchecked.

af_downmix is an example of a function that can/will crash for invalid values.
0 is not invalid since it is used as "autodetect" for output.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34342 b3059339-0415-0410-9bf9-f77b7e298cf2
Author: reimar
This commit is contained in:
mplayer-svn 2011-11-11 17:15:13 +00:00 committed by wm4
parent 595928542a
commit e687d1e51a
1 changed files with 4 additions and 0 deletions

View File

@ -694,5 +694,9 @@ void af_help (void) {
void af_fix_parameters(af_data_t *data)
{
if (data->nch < 0 || data->nch > AF_NCH) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "Invalid number of channels %i, assuming 2.\n", data->nch);
data->nch = 2;
}
data->bps = af_fmt2bits(data->format)/8;
}