mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-25 06:59:52 -05:00
various places: Include resampler delay to latency reports and calculations
The resampler delay was not taken into account in all necessary places. This patch adds it where required. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/708>
This commit is contained in:
parent
3271020747
commit
2af10cf39b
9 changed files with 31 additions and 0 deletions
|
|
@ -460,6 +460,9 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
|
|||
/* Add the latency internal to our sink input on top */
|
||||
pa_bytes_to_usec(pa_memblockq_get_length(u->sink_input->thread_info.render_memblockq), &u->sink_input->sink->sample_spec);
|
||||
|
||||
/* Add resampler delay */
|
||||
*((int64_t*) data) += pa_resampler_get_delay_usec(u->sink_input->thread_info.resampler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1053,6 +1056,9 @@ static void source_output_snapshot_within_thread(struct userdata *u, struct snap
|
|||
|
||||
now = pa_rtclock_now();
|
||||
latency = pa_source_get_latency_within_thread(u->source_output->source, false);
|
||||
/* Add resampler delay */
|
||||
latency += pa_resampler_get_delay_usec(u->source_output->thread_info.resampler);
|
||||
|
||||
delay = pa_memblockq_get_length(u->source_output->thread_info.delay_memblockq);
|
||||
|
||||
delay = (u->source_output->thread_info.resampler ? pa_resampler_request(u->source_output->thread_info.resampler, delay) : delay);
|
||||
|
|
@ -1132,6 +1138,9 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
|
|||
|
||||
now = pa_rtclock_now();
|
||||
latency = pa_sink_get_latency_within_thread(u->sink_input->sink, false);
|
||||
/* Add resampler delay */
|
||||
latency += pa_resampler_get_delay_usec(u->sink_input->thread_info.resampler);
|
||||
|
||||
delay = pa_memblockq_get_length(u->sink_input->thread_info.render_memblockq);
|
||||
|
||||
delay = (u->sink_input->thread_info.resampler ? pa_resampler_request(u->sink_input->thread_info.resampler, delay) : delay);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue