mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ALSA: Compress - add codec parameter checks
Conflicts: include/sound/compress_params.h Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1fc6bd456b
commit
42dac55493
2 changed files with 11 additions and 0 deletions
|
@ -86,6 +86,7 @@
|
||||||
#define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x00000012)
|
#define SND_AUDIOCODEC_DTS_PASS_THROUGH ((__u32) 0x00000012)
|
||||||
#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000013)
|
#define SND_AUDIOCODEC_DTS_LBR ((__u32) 0x00000013)
|
||||||
#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000014)
|
#define SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK ((__u32) 0x00000014)
|
||||||
|
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_DTS_TRANSCODE_LOOPBACK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Profile and modes are listed with bit masks. This allows for a
|
* Profile and modes are listed with bit masks. This allows for a
|
||||||
|
|
|
@ -432,6 +432,16 @@ static int snd_compress_check_input(struct snd_compr_params *params)
|
||||||
params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
|
params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* now codec parameters */
|
||||||
|
if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (params->codec.ch_in == 0 || params->codec.ch_out == 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!(params->codec.sample_rate & SNDRV_PCM_RATE_8000_192000))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue