mirror of https://github.com/thesofproject/sof.git
SRC: Add checks for number of channels when initializing from params
This patch prevents SRCs init to loop past PLATFORM_MAX_CHANNELS. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
parent
efbb97bb05
commit
849a528506
|
@ -322,7 +322,7 @@ static int src_params(struct comp_dev *dev)
|
|||
size_t delay_lines_size;
|
||||
uint32_t source_rate, sink_rate;
|
||||
int32_t *buffer_start;
|
||||
int n = 0, i, err, frames_is_for_source, q;
|
||||
int n = 0, i, err, frames_is_for_source, nch, q;
|
||||
|
||||
trace_src("par");
|
||||
|
||||
|
@ -392,7 +392,8 @@ static int src_params(struct comp_dev *dev)
|
|||
buffer_start = cd->delay_lines + need.scratch;
|
||||
|
||||
/* Initize SRC for actual sample rate */
|
||||
for (i = 0; i < params->channels; i++) {
|
||||
nch = MIN(params->channels, PLATFORM_MAX_CHANNELS);
|
||||
for (i = 0; i < nch; i++) {
|
||||
n = src_polyphase_init(&cd->src[i], source_rate, sink_rate,
|
||||
&need, buffer_start);
|
||||
buffer_start += need.single_src;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define SRC_CORE_H
|
||||
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
struct src_alloc {
|
||||
int fir_s1;
|
||||
|
|
Loading…
Reference in New Issue