[RAOP] [PATCH] Fix audio synchronisation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2017-07-22 at 14:53 +0200, Colin Leroy wrote:
> diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c
> index e5d219e..108f855 100644
> --- a/src/modules/raop/raop-sink.c
> +++ b/src/modules/raop/raop-sink.c
> @@ -118,6 +118,13 @@ static int64_t sink_get_latency(const struct userdata *u) {
>      now = pa_smoother_get(u->smoother, now);
>  
>      latency = pa_bytes_to_usec(u->write_count, &u->sink->sample_spec) - (int64_t) now;
> +    if (latency < 0) {
> +       latency = 0;
> +    }
> +
> +    latency += 2000000; /* RAOP default latency */
> +    latency += pa_raop_client_get_rtp_diff(u->raop) * 1000; /* plus last packet length in usec */

pa_raop_client_get_rtp_diff() returns the size of the last audio chunk
in bytes divided by four, but you treat that as a time value. That's a
clear bug.

Adding the size of the last packet doesn't make sense to me anyway,
though. The size of the last packet is already taken into account in u-
>write_count. Now you're counting it twice.

If the 2 second constant results in too low latency, I think the
constant should be made bigger.

-- 
Tanu

https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux