pa_sink_set_fixed_latency_within_thread(u->sink, i->sink->thread_info.fixed_latency);
- pa_sink_set_max_request_within_thread(u->sink, pa_sink_input_get_max_request(i));
+ pa_sink_set_max_request_within_thread(u->sink, pa_sink_input_get_max_request(i) * u->sink_fs / u->fs);
/* FIXME: Too small max_rewind:
* https://bugs.freedesktop.org/show_bug.cgi?id=53709 */
- pa_sink_set_max_rewind_within_thread(u->sink, pa_sink_input_get_max_rewind(i));
+ pa_sink_set_max_rewind_within_thread(u->sink, pa_sink_input_get_max_rewind(i) * u->sink_fs / u->fs);
pa_sink_attach_within_thread(u->sink);
}
PA_RESAMPLER_SRC_SINC_BEST_QUALITY, PA_RESAMPLER_NO_REMAP);
u->hrir_samples = hrir_temp_chunk.length / pa_frame_size(&hrir_temp_ss) * hrir_ss.rate / hrir_temp_ss.rate;
+ if (u->hrir_samples > 64) {
+ u->hrir_samples = 64;
+ pa_log("The (resampled) hrir contains more than 64 samples. Only the first 64 samples will be used to limit processor usage.");
+ }
+
hrir_total_length = u->hrir_samples * pa_frame_size(&hrir_ss);
u->hrir_channels = hrir_ss.channels;
/* add silence to the hrir until we get enough samples out of the resampler */
while (hrir_copied_length < hrir_total_length) {
pa_resampler_run(resampler, &hrir_temp_chunk, &hrir_temp_chunk_resampled);
- /* Silence input block */
- pa_silence_memblock(hrir_temp_chunk.memblock, &hrir_temp_ss);
+ if (hrir_temp_chunk.memblock != hrir_temp_chunk_resampled.memblock) {
+ /* Silence input block */
+ pa_silence_memblock(hrir_temp_chunk.memblock, &hrir_temp_ss);
+ }
if (hrir_temp_chunk_resampled.memblock) {
/* Copy hrir data */