[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] loopback: Fix sink latency calculation if source is alsa source with fixed latency
PulseAudio Marge Bot
gitlab at gitlab.freedesktop.org
Mon Jan 4 20:22:09 UTC 2021
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
0efae048 by Georg Chini at 2021-01-04T20:16:52+00:00
loopback: Fix sink latency calculation if source is alsa source with fixed latency
When an alsa source with fixed latency is used, the actual latency of the source
will only be one fragment size. This is not taken into account when the required
sink latency is calculated.
This patch fixes the issue.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/451>
- - - - -
1 changed file:
- src/modules/module-loopback.c
Changes:
=====================================
src/modules/module-loopback.c
=====================================
@@ -1016,6 +1016,14 @@ static void set_sink_input_latency(struct userdata *u, pa_sink *sink) {
if (u->min_source_latency > requested_latency) {
latency = PA_MAX(u->latency, u->minimum_latency);
requested_latency = (latency - u->min_source_latency) / 2;
+ /* In the case of a fixed alsa source, u->minimum_latency is calculated from
+ * the default fragment size while u->min_source_latency is the reported minimum
+ * of the source latency (nr_of_fragments * fragment_size). This can lead to a
+ * situation where u->minimum_latency < u->min_source_latency. We only fall
+ * back to use the fragment size instead of min_source_latency if the calculation
+ * above does not deliver a usable result. */
+ if (u->fixed_alsa_source && u->min_source_latency >= latency)
+ requested_latency = (latency - u->core->default_fragment_size_msec * PA_USEC_PER_MSEC) / 2;
}
latency = PA_CLAMP(requested_latency , u->min_sink_latency, u->max_sink_latency);
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/0efae0488ccd4536926f5fa2b4cf524e63da9095
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/0efae0488ccd4536926f5fa2b4cf524e63da9095
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210104/3d578c55/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list