mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 19:21:06 +00:00
Cleanups
This commit is contained in:
parent
8fddf7f1ff
commit
9ccae28f6e
@ -796,8 +796,10 @@ bool audio_driver_find_driver(void)
|
||||
|
||||
void audio_driver_deinit_resampler(void)
|
||||
{
|
||||
rarch_resampler_freep(&audio_driver_resampler,
|
||||
&audio_driver_resampler_data);
|
||||
if (audio_driver_resampler && audio_driver_resampler_data)
|
||||
audio_driver_resampler->free(audio_driver_resampler_data);
|
||||
audio_driver_resampler = NULL;
|
||||
audio_driver_resampler_data = NULL;
|
||||
}
|
||||
|
||||
bool audio_driver_free_devices_list(void)
|
||||
@ -852,8 +854,8 @@ void audio_driver_process_resampler(void *data)
|
||||
struct resampler_data *resampler = (struct resampler_data*)data;
|
||||
performance_counter_init(&resampler_proc, "resampler_proc");
|
||||
performance_counter_start(&resampler_proc);
|
||||
rarch_resampler_process(audio_driver_resampler,
|
||||
audio_driver_resampler_data, resampler);
|
||||
|
||||
audio_driver_resampler->process(audio_driver_resampler_data, resampler);
|
||||
performance_counter_stop(&resampler_proc);
|
||||
}
|
||||
|
||||
|
@ -181,20 +181,6 @@ const char *audio_resampler_driver_find_ident(int index);
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio);
|
||||
|
||||
/* Convenience macros.
|
||||
* freep makes sure to set handles to NULL to avoid double-free
|
||||
* in rarch_resampler_realloc. */
|
||||
#define rarch_resampler_freep(backend, handle) do { \
|
||||
if (*(backend) && *(handle)) \
|
||||
(*backend)->free(*handle); \
|
||||
*backend = NULL; \
|
||||
*handle = NULL; \
|
||||
} while(0)
|
||||
|
||||
#define rarch_resampler_process(backend, handle, data) do { \
|
||||
(backend)->process(handle, data); \
|
||||
} while(0)
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
||||
data.input_frames = sizeof(input_f) / (2 * sizeof(float));
|
||||
data.ratio = ratio * rate_mod;
|
||||
|
||||
rarch_resampler_process(resampler, re, &data);
|
||||
resampler->process(re, &data);
|
||||
|
||||
output_samples = data.output_frames * 2;
|
||||
|
||||
@ -97,6 +97,9 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
rarch_resampler_freep(&resampler, &re);
|
||||
if (resampler && re)
|
||||
resampler->free(re);
|
||||
resampler = NULL;
|
||||
re = NULL;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ int main(int argc, char *argv[])
|
||||
data.input_frames = in_rate * 2;
|
||||
data.ratio = ratio;
|
||||
|
||||
rarch_resampler_process(resampler, re, &data);
|
||||
resampler->process(re, &data);
|
||||
|
||||
/* We generate 2 seconds worth of audio, however,
|
||||
* only the last second is considered so phase has stabilized. */
|
||||
@ -346,7 +346,10 @@ int main(int argc, char *argv[])
|
||||
res.alias_freq[2] / (float)in_rate, res.alias_power[2]);
|
||||
}
|
||||
|
||||
rarch_resampler_freep(&resampler, &re);
|
||||
if (resampler && re)
|
||||
resampler->free(re);
|
||||
resampler = NULL;
|
||||
re = NULL;
|
||||
|
||||
free(input);
|
||||
free(output);
|
||||
|
@ -762,8 +762,10 @@ static void ffmpeg_free(void *data)
|
||||
if (handle->config.audio_opts)
|
||||
av_dict_free(&handle->config.audio_opts);
|
||||
|
||||
rarch_resampler_freep(&handle->audio.resampler,
|
||||
&handle->audio.resampler_data);
|
||||
if (handle->audio.resampler && handle->audio.resampler_data)
|
||||
handle->audio.resampler->free(handle->audio.resampler_data);
|
||||
handle->audio.resampler = NULL;
|
||||
handle->audio.resampler_data = NULL;
|
||||
|
||||
av_free(handle->audio.float_conv);
|
||||
av_free(handle->audio.resample_out);
|
||||
@ -1188,10 +1190,10 @@ static void ffmpeg_audio_resample(ffmpeg_t *handle,
|
||||
info.input_frames = aud->frames;
|
||||
info.ratio = handle->audio.ratio;
|
||||
|
||||
rarch_resampler_process(handle->audio.resampler,
|
||||
handle->audio.resampler_data, &info);
|
||||
aud->data = handle->audio.resample_out;
|
||||
aud->frames = info.output_frames;
|
||||
handle->audio.resampler->process(handle->audio.resampler_data, &info);
|
||||
|
||||
aud->data = handle->audio.resample_out;
|
||||
aud->frames = info.output_frames;
|
||||
|
||||
if (!handle->audio.use_float)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user