Download raw body.
net/dino: Lower audio device latency
On Mon, 14 Jul 2025 12:45:35 +0200,
Alexandre Ratchov <alex@caoua.org> wrote:
>
> net/dino uses the default gstreamer audio device latency of 200ms. It
> is huge for this purpose and makes phone calls unpleasant. This diff
> is to set it to 20ms.
>
> Long version:
>
> Audio packets are received into a network buffer (aka a jitter buffer,
> of around 50ms-100ms) to accomodate with the network jitter and the
> difference in sample rate between the two peers. Then, small chunks of
> data are retrieved periodically from the jitter buffer and sent to the
> audio device, which queues them in its own audio buffer.
>
> Unlike the jitter buffer, the audio buffer doesn't need to be
> large. It needs to be just large enough to leave the program the time
> to copy an audio block from the jitter buffer to the device, which is
> very fast. 10ms-20ms would be enough.
>
> OK?
>
This changes make sense and I think it should be sent upstream.
But I can't test it because by some reason gstreamer doesn't find any
devices on my system.
Frankly, I haven't dig into it. Probably it worked before, but I not sure.
Anyway, I had tested your patch: it builds and doesn't introduce any
regression on my use case.
I assume that you had tested it, and it works.
With this assumption OK kirill@
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/dino/Makefile,v
> diff -u -p -r1.38 Makefile
> --- Makefile 19 Apr 2025 17:07:52 -0000 1.38
> +++ Makefile 14 Jul 2025 10:19:20 -0000
> @@ -1,5 +1,6 @@
> COMMENT= XMPP desktop client
> VERSION= 0.5.0
> +REVISION= 0
> DISTNAME= dino-${VERSION}
> CATEGORIES= net x11
>
> Index: patches/patch-plugins_rtp_src_device_vala
> ===================================================================
> RCS file: patches/patch-plugins_rtp_src_device_vala
> diff -N patches/patch-plugins_rtp_src_device_vala
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-plugins_rtp_src_device_vala 14 Jul 2025 10:19:20 -0000
> @@ -0,0 +1,14 @@
> +Index: plugins/rtp/src/device.vala
> +--- plugins/rtp/src/device.vala.orig
> ++++ plugins/rtp/src/device.vala
> +@@ -440,6 +440,10 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Ob
> + debug("Creating device %s", id);
> + plugin.pause();
> + element = device.create_element(id);
> ++ if (media == "audio" && is_sink) {
> ++ // lower the audio device latency from 200ms (the default) to 20ms.
> ++ element.@set("buffer-time", 20000);
> ++ }
> + if (is_sink) {
> + element.@set("async", false);
> + element.@set("sync", false);
--
wbr, Kirill
net/dino: Lower audio device latency