btstack_resample: validate num channels in init

This commit is contained in:
Matthias Ringwald 2024-12-05 14:04:11 +01:00
parent 0532fef7b5
commit 4245bf3de9

View File

@ -42,10 +42,14 @@
#include "btstack_resample.h"
void btstack_resample_init(btstack_resample_t * context, int num_channels){
btstack_assert(num_channels <= BTSTACK_RESAMPLE_MAX_CHANNELS);
context->src_pos = 0;
context->src_step = 0x10000; // default resampling 1.0
context->last_sample[0] = 0;
context->last_sample[1] = 0;
int i;
for (i = 0; i < num_channels; i++){
context->last_sample[i] = 0;
}
context->num_channels = num_channels;
}