From 5b941737519c170c4710d1ec7823866ee080a67e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 14 May 2019 16:13:24 +0300 Subject: lib/igt_audio: make audio_signal_detect take const data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit audio_signal_detect uses gsl_fft_real_radix2_transform which mutates the data array. This can be surprising when calling audio_signal_detect and then read again the data (e.g. for another check). Instead of mutating the array, make audio_signal_detect less error-prone by taking a const parameter. Do an internal copy before calling the gsl function. Signed-off-by: Simon Ser Reviewed-by: Ville Syrjälä --- lib/igt_audio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/igt_audio.h') diff --git a/lib/igt_audio.h b/lib/igt_audio.h index 466e772a..d5ba1caa 100644 --- a/lib/igt_audio.h +++ b/lib/igt_audio.h @@ -43,7 +43,7 @@ void audio_signal_reset(struct audio_signal *signal); void audio_signal_fill(struct audio_signal *signal, int16_t *buffer, size_t buffer_len); bool audio_signal_detect(struct audio_signal *signal, int sampling_rate, - int channel, double *data, size_t data_len); + int channel, const double *samples, size_t samples_len); size_t audio_extract_channel_s32_le(double *dst, size_t dst_cap, int32_t *src, size_t src_len, int n_channels, int channel); -- cgit v1.2.3