diff options
author | Simon Ser <simon.ser@intel.com> | 2019-05-14 16:13:24 +0300 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-05-15 10:40:58 +0300 |
commit | 5b941737519c170c4710d1ec7823866ee080a67e (patch) | |
tree | ac079743656a2fd94a7385120b37aea8fde249f0 /lib/igt_audio.h | |
parent | 61922e7321d8b5169bc1e83ebe4618060a43920c (diff) |
lib/igt_audio: make audio_signal_detect take const data
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 <simon.ser@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib/igt_audio.h')
-rw-r--r-- | lib/igt_audio.h | 2 |
1 files changed, 1 insertions, 1 deletions
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); |