module-rtp: Allow aes67 send with a non PTP clock

Our current AES67 sender setup requires that that PTP driver drive the
entire graph. This adds support for allowing the AES67 RTP sink to be
driven by an arbitrary driver, while still using the PTP driver for
sending data on the network.

When aes67.driver-group is specified a pw_filter is created with no
ports, node.always-process = true and node.group set to the
aes67.driver-group. When set to PTP, this gives us process callbacks at
the PTP rate which we use to get the current PTP time in the RTP sender
by interpolating the clock snapshots from the pw-filter.

Implementation ideas from Wim Taymans. Co-authored with Sanchayan Maity.

For a detailed reference, refer the following papers by Fons Adriaensen.
- Using a DLL to filter time
  (https://kokkinizita.linuxaudio.org/papers/usingdll.pdf)
- Controlling adaptive resampling
  (http://kokkinizita.linuxaudio.org/papers/adapt-resamp.pdf)
This commit is contained in:
Arun Raghavan 2024-08-15 11:26:13 -04:00 committed by Arun Raghavan
parent 9ccf62d4f6
commit 9f643fec7e
4 changed files with 289 additions and 7 deletions

View file

@ -65,6 +65,8 @@
* - `sess.ts-refclk = <string>`: the name of a reference clock
* - `sess.media = <string>`: the media type audio|midi|opus, default audio
* - `stream.props = {}`: properties to be passed to the stream
* - `aes67.driver-group = <string>`: for AES67 streams, can be specified in order to allow
* the sink to be driven by a different node than the PTP driver.
*
* ## General options
*
@ -145,6 +147,7 @@ PW_LOG_TOPIC(mod_topic, "mod." NAME);
"( audio.rate=<sample rate, default:"SPA_STRINGIFY(DEFAULT_RATE)"> ) " \
"( audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS)"> ) " \
"( audio.position=<channel map, default:"DEFAULT_POSITION"> ) " \
"( aes67.driver-group=<driver driving the PTP send> ) " \
"( stream.props= { key=value ... } ) "
static const struct spa_dict_item module_info[] = {
@ -549,6 +552,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
copy_props(impl, props, "sess.max-ptime");
copy_props(impl, props, "sess.latency.msec");
copy_props(impl, props, "sess.ts-refclk");
copy_props(impl, props, "aes67.driver-group");
str = pw_properties_get(props, "local.ifname");
impl->ifname = str ? strdup(str) : NULL;