virtual sources: Include resampler delay in latency reports

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
This commit is contained in:
Georg Chini 2021-01-01 00:29:28 +01:00 committed by PulseAudio Marge Bot
parent d55fde2fed
commit 129a59a2f0
3 changed files with 9 additions and 0 deletions

View file

@ -422,6 +422,9 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
/* and the buffering we do on the source */ /* and the buffering we do on the source */
pa_bytes_to_usec(u->source_output_blocksize, &u->source_output->source->sample_spec); pa_bytes_to_usec(u->source_output_blocksize, &u->source_output->source->sample_spec);
/* Add resampler delay */
*((int64_t*) data) += pa_resampler_get_delay_usec(u->source_output->thread_info.resampler);
return 0; return 0;
case PA_SOURCE_MESSAGE_SET_VOLUME_SYNCED: case PA_SOURCE_MESSAGE_SET_VOLUME_SYNCED:

View file

@ -101,6 +101,9 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
/* Add the latency internal to our source output on top */ /* Add the latency internal to our source output on top */
pa_bytes_to_usec(pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq), &u->source_output->source->sample_spec); pa_bytes_to_usec(pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq), &u->source_output->source->sample_spec);
/* Add resampler delay */
*((int64_t*) data) += pa_resampler_get_delay_usec(u->source_output->thread_info.resampler);
return 0; return 0;
} }

View file

@ -177,6 +177,9 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
/* FIXME, no idea what I am doing here */ /* FIXME, no idea what I am doing here */
pa_bytes_to_usec(pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq), &u->source_output->source->sample_spec); pa_bytes_to_usec(pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq), &u->source_output->source->sample_spec);
/* Add resampler delay */
*((int64_t*) data) += pa_resampler_get_delay_usec(u->source_output->thread_info.resampler);
return 0; return 0;
} }