markmcconnell / mai

Mark's AES67 Implementation
BSD 3-Clause "New" or "Revised" License
93 stars 22 forks source link

How is sync working? #6

Closed mr-berndt closed 2 years ago

mr-berndt commented 2 years ago

Thx for all the quick fixes!

One (hopefully last) question remains: How is the timing actually working? To my understanding jack starts with a given backend and is synced to that backend, timing-wise, eg. the 48 kHz clock of a soundcard or a jack-master over the network.

Now I understand that AES67 relies on a clock master in the network, so I ask myself how these two clocks - which cannot be in perfect sync - are handled? Is there resampling implemented or framedropping/-inserting, or how is this taken care of. Should not the AES67 bit be a backend rather that sort of a bridge or am I just overseeing something?

Sorry if this is not actually "an issue" but a question, but I would not know where to ask it otherwise.

markmcconnell commented 2 years ago

No worries.

If the clock gap is large enough, there will be RTP frames dropped.

If the clock gap is small enough (<16 samples) then we will add or remove a single sample, by interpolation, from the jack audio buffer before sending or receiving from the network until the gap has moved to 0. There is no control loop or anything, we compare clocks, and make changes until the clocks have a 0 difference between them.

On my network this seems to be sufficient, but feedback would be welcome.