bondagit / aes67-linux-daemon

AES67 Linux Daemon with configuration WebUI
GNU General Public License v3.0
372 stars 82 forks source link

Is it possible to reduce the delay of a sink to 48 frames? #128

Closed juandesanchezm closed 1 year ago

juandesanchezm commented 1 year ago

To reduce latency, I have configured a sink with a 48-frame delay. However, when it stops receiving a source, a constant beep is played. How could I solve this? Thank you in advance.

bondagit commented 1 year ago

The minimum jitter buffer I suggest for a sink is 192 frames.
You can further reduce the latency by changing the TIC frame size @1FS (samples) of the daemon to 48 frames instead of 64. The value of 64 is the default because it allows compatibility with JACK. When you stop receiving on a Sink you should get silence; no idea why you are getting a beep.

juandesanchezm commented 1 year ago

If I set the jitter buffer to 192 and it stops receiving a source, it goes silent, but when I set it to 48, that's when it starts beeping. I suppose there is some dirt in the audio buffer

bondagit commented 1 year ago

try with a longer delay (up to 960 frames). If you are still receiving silence maybe your source is not in sync with the PTP master clock or for some reasons you have high latency on the network.

juandesanchezm commented 1 year ago

If I set the delay jitter on the sink to 96, it works correctly, and it no longer produces a beep when it stops receiving the AES67 source. Do you have any ideas on where to look for the issue?

bondagit commented 1 year ago

I know the driver on the ALSA device accepts a minimum of two periods of TIC frame size samples (48/64) and this is done to avoid overrun or underrun on the capture / playback devices. I am not aware of any part in the code where a beep can be produced. You can look at the ProcessRTPAudioPacket function in the driver starting at 716 where the delay you set is used: https://github.com/bondagit/ravenna-alsa-lkm/blob/aes67-daemon/driver/RTP_audio_stream.c#L716