[pulseaudio-discuss] [Patch] RAOP: fix audio synchronisation, take two

Tanu Kaskinen tanuk at iki.fi
Sun Sep 17 16:51:58 UTC 2017


"git am" fails to apply the patch on top of the master branch (as it
failed to apply the previous versions too, but I forgot to mention that
earlier).


On Fri, 2017-09-15 at 21:34 +0200, Colin Leroy wrote:
> From ffda854fab9641a66eacdf7bdd812f41f2af65ce Mon Sep 17 00:00:00 2001
> From: Colin Leroy <colin at colino.net>
> Date: Sat, 22 Jul 2017 14:50:40 +0200
> Subject: [PATCH] RAOP: Announce real latency
> 
> Use predefined values depending on the server, and make it configurable.
> AirPlay is supposed to have 2s of latency. With my hardware, this is
> more 2.352 seconds after numerous tests.

The commit message could explain also why pa_smoother_reset() is used
instead of pause()/resume().

> +    if (pa_modargs_get_value(ma, "latency_msec", NULL) != NULL) {
> +        if (pa_modargs_get_value_u32(ma, "latency_msec", &l) == 0) {
> +            u->latency_set = true;
> +            u->latency = l;
> +       }
> +    }

Why do you check the return value of pa_modargs_get_value() before
calling pa_modargs_get_value_u32()? As far as I can tell, that makes no
difference.

> @@ -119,6 +122,9 @@ static int64_t sink_get_latency(const struct userdata *u) {
>  
>      latency = pa_bytes_to_usec(u->write_count, &u->sink->sample_spec) - (int64_t) now;
>  
> +    /* RAOP default latency */
> +    latency += u->latency * 1000;

Nitpicking: the convention is to use the PA_USEC_PER_MSEC constant
instead of bare "1000".

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list