diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 5aaaeb2b..6e6a71a2 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -4000,6 +4000,16 @@ static void adev_close_input_stream(struct audio_hw_device *dev, /* prevent concurrent out_set_parameters, or out_write from standby */ pthread_mutex_lock(&adev->lock_inputs); + if (in->read_buf) { + free(in->read_buf); + in->read_buf = NULL; + } + + if (in->resampler) { + release_resampler(in->resampler); + in->resampler = NULL; + } + #ifdef PREPROCESSING_ENABLED int i; @@ -4007,11 +4017,6 @@ static void adev_close_input_stream(struct audio_hw_device *dev, free(in->preprocessors[i].channel_configs); } - if (in->read_buf) { - free(in->read_buf); - in->read_buf = NULL; - } - if (in->proc_buf_in) { free(in->proc_buf_in); in->proc_buf_in = NULL; @@ -4027,10 +4032,6 @@ static void adev_close_input_stream(struct audio_hw_device *dev, in->ref_buf = NULL; } - if (in->resampler) { - release_resampler(in->resampler); - in->resampler = NULL; - } #endif in_standby_l(in);