-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable use of a local PTP master clock on the daemon host #34
Comments
The problem appears to be in manager.c Is that really necessary, other than use of the device failing if there's no PTP lock? |
AES67 mandates the use of a PTP master clock. This clock provides the base reference for all the streams in the AES67 network. Without a master clock it's not possible to start sending or handling sync of received RTP streams. |
Thanks. I understand a clock is needed. It's just (for my use case) a very inconvenient place to wait for PTP to maybe become active. I opened the ticket, because at first I didn't know what was causing that delay. Patching ptp4l to allow a local clock to run with the daemon is an interesting idea. It'd be very useful to have the daemon with a clock in a single device. |
I see your point. This is also creating troubles to other sound systems like PulseAudio that queries all the available audio devices. Unfortunately the setting of the sample rate has to be completed prior to starting the tick timer interrupt because it impacts the frame size. As discussed you can patch ptp4l to allow the driver to work as standard PTP slave. Anyway this is not the more convenient way to sync with the local clock. If the clock master is running on the same device the driver might read the PTP clock via other methods. At the moment this is not implemented. |
There appears to be more to it than enabling multicast loopback. I've changed ptp4l to set IP_MULTICAST_LOOP on the interface to 1 instead of 0. Unfortunately that didn't make a difference. However, when I start the daemon, ptp4l seems to stop receiving packets from the multicast group also. There is no more indication of it receiving anything from the remote master and it selects itself as grand master. The daemon however does see and select the remote master. When I test without another clock on the network and only patched ptp4l running locally, the daemon doesn't find any clock. netstat -g shows the correct number of memberships to ptp-primary.mcast.net. (2 with ptp4l, 1 with the daemon, 3 with both.) Any idea what I might be missing? |
Sorry, enabling multicast loop did work, I was accidentally running ptp4l in slave mode. But the daemon still prevents ptp4l from seeing other clocks on the network, which is problematic when the rest of the network selects a different master. |
ok.
It this works I may add this patch to the repo. |
That works, thanks! Regarding ptp4l, I got myself a bit confused yesterday. There is no difference between setting IP_MULTICAST_LOOP on or off. The daemon doesn't see the clock when only announcing on Ethernet, but it works as expected when including loopback , i.e. For reference, here are the changes I made to ptp4l:
|
Thanks for your tests. I tried myself and I have same result as you. |
Thanks for confirming this. With your module patch and with software timestamping, it works fine running ptp4l on Ethernet and loopback at once. Since I'm running this on a Pi, I have to use software mode anyway, but I assume it's a showstopper for systems with hardware timestamping. |
I added a patch to the driver to allow locking on a local PTP master clock. |
Works with patched ptp4l running on eth0 only. The daemon sees both the local and remote clocks. Thank you! |
Great! Thanks for the quick feedback. |
I merged the content aes67-daemon-local_traffic_support into aes67-daemon branch and changed the driver version to 1.1. |
I've encountered a problem trying to combine the AES67 daemon with PJSIP. To query devices and their capabilities, PJSIP will open them. However, when there is no PTP lock, opening the RAVENNA device has a timeout of over two minutes.
The delay appears to happen in audio_driver.c mr_alsa_audio_pcm_prepare() between
printk(KERN_DEBUG "mr_alsa_audio_pcm_prepare: rate=%d format=%d channels=%d period_size=%lu, nb periods=%u\n", runtime->rate, runtime->format, runtime->channels, runtime->period_size, runtime->periods);
and
printk(KERN_DEBUG "mr_alsa_audio_pcm_prepare for playback stream\n");
I'm guessing it's related to setting the sample rate.
I haven't found a way to run ptp4l on the same interface as the daemon, and since the system is designed to allow running PJSIP on other devices, too, I need to be able to query interfaces even when there's no PTP (c)lock.
Do you have an idea how to work around that dilemma?
Thanks!
The text was updated successfully, but these errors were encountered: