Add pw_conf_section_update_props_rules() that will not only update the
properties of a section but wil also apply rules in section.rules and
match against the context properties.
Use this by default when using pw_context_conf_update_props().
Add a new method to get a string name of the VM type. Place the
cpu.vm.name in the context properties.
This makes it possible to deprecate the vm.overrides with something more
flexible based on rules. Update the conf files and docs to refect this.
For capture streams, place the time of the cycle when we received this
buffer in the new buffer time field.
Without this (and without timestamps in an optional header metadata)
it's impossible to determine when a buffer was created. With this field
and the pw_stream_get_time_n() and pw_stream_get_nsec() we can derive
the mapping to ticks and delay in the graph.
This does a couple of things: first, we implement revents demangling,
which seems to be required (although hw: devices work fine without it).
The second is to actually read the ctl events so we can tell when
elements we care about have changed, instead of reading everything and
trying to do a diff.
The latter is also required from a correctness perspective, as otherwise
the ctl might keep triggering wakeups while the fd is ready to be read.
Always copy the timing info when capturing, not only when there is a
buffer to dequeue.
We can update the rate_queued and rate_size with defaults when we don't
have rate matching. We can then also directly use the rate_size field
to update the buffer requested size.
Add a new extension that can create a server on a user provided socket
with user provided security properties.
This is mainly used in flatpaks that want to create and bind a pipewire
socket with specific permissions for the flatpak app.
The flatpak will also provide an fd that will be closed when the server
can be removed.
nframes in the midi buffer should be set to the current cycle
buffer_size and it should restrict the timestamps that can be set on the
midi events.
Keep the last max_frames around in a globals so that we can use it to
set the midi buffer to the default size.
Return NULL when we do jack_port_get_buffer() with larger nframes than
the current cycle buffer_size, just like JACK. Otherwise this could
result in a crash when we try to mix more than the available buffer
space.
Check and reset the midi buffer better. Check if the MAGIC is still ok.
jack_midi_reset_buffer() should restore the MAGIC and other values.
The output buffer size is always the current cycle buffer_size.
The size that is give by the JACK API is only used to restrict the
number of mixdown samples or midi offsets.
Fixes#3892
Remove some of the hardcoded values (the absolute smallest buffer size,
independent on the sample rate) to a config option. Set it to the
default value of 4, like what it was before.
Change the hardcoded absolute lowest limit to 1 because anything else
does not make sense.
Enforce the quantum-floor when calculating the final graph quantum.
Fixes#3908
Add a monitor.passthrough option. This will pass all latency information
directly between the port and its monitor ports.
This is interesting when the adapter (and audioconvert) is used with a
null-audio-sink that simply forwards the data to a real sink/souce. In
that case, we want the sink/source latency to be passed unmodified.
Set the monitor.passthrough on the pulseaudio null-sink because
a passthrough virtual sink is the most likely use case for this.
Add some monitor.passthrough default config where it makes sense.
Fixes#3888
Add options to change the 'prefix' and 'sysconfdir' values shown in
documentation, e.g. on config file man pages.
Update CI to set them, so that its produced output doesn't show
/builds/pipewire/... on man pages
On the midi input ports, do the same trick as on the output ports:
first convert the midi to JACK and then copy the whole buffer to the
port specific storage.
This makes it possible to have a different midi buffer per port and
allow multiple threads to get the buffer concurrently.
Fixes#3901
When the midi message does not fit in the current cycle, save it in a
buffer and send it in the next cycle.
Incomplete midi messages will be received in the next cycle and need to
be sent out at timestamp 0 of the cycle.
Detect dropped and incomplete messages and give a warning.
Try to close/open the ffado device when streaming_start() fails. This
seems to be the case after suspend/resume or a cable disconnect.
Unfortunately, ffado seems to be stuck in an unrecoverable state,
though, to make it really work...
Clean up port buffers when the filter is destroyed.
When timer is not using monotonic clock, apply clock offset to translate
the time values to the monotonic clock when putting them to spa_io_clock
nsec fields.
Get appropriate clock offset by smoothed filtering. The parameters here
keep the offset jitter < 10ns or so.
As monotonic/boottime/realtime all contain adjtime(), there generally is
no drift in the offset here, so just averaging should be fine.
Also fix using wrong timer clock when freewheeling.
If ncurses is not initialized, then the global `LINES` variable stays 0.
This will cause problems because there is an unconditional `if (y > LINES)`
check when printing the driven nodes for a given driver node, resulting
in only the first one being printed.
Commit 71653e04d2 ("pw-top: add 'batch-mode' and iterations known from top")
that introduced batch mode missed this one condition, so fix that
by only checking the for terminal overflow in non-batch mode as
it is done a couple lines above.
Fixes#3899
Variable declarations after a label are not allowed,
and clang does not accept them. Fix the build failure
by removing the variable.
Fixes b3fbd0e607 ("alsa-pcm: add_bind_ctl_param: add support for array")
`gst_caps_make_writable()` may create a copy which we have to keep
using afterwards. The return value was meant to be used for that,
but was promptly forgotten for the initial user.
Avoid such errors in the future by using an in-out parameter instead.
While on it, add a type check and remove a check for an impossible
condition.
Fixes: 8a271a87b ("gst: Sanitize caps before translating")
gst-play uses autoaudiosink by default when playing audio, which
iterates over all sinks sorting them by rank. By default,
pipewiresink sets the rank to 0, but it can be overridden
by setting the GST_PLUGIN_FEATURE_RANK env. var. like this:
`GST_PLUGIN_FEATURE_RANK=pipewiresink:268 gst-play-1.0 /usr/share/sounds/alsa/test.wav`
But that doesn't work either because the autoaudiosink plugin also
filters the available options, testing for "Sink" and "Audio" to
appear in the classification metadata
(in the strstr comparison in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-good/gst/autodetect/gstautodetect.c?ref_type=heads#L220
klass is what's set by pipewire as classification,
self->type_klass is "Sink" and self->media_klass is "Audio")
Just adding the word Audio to the classification metadata fixes
this and allows pipewiresink to be selected by autoaudiosink.
I also set it in the source plugin since looking at the code,
autoaudiosrc works exactly the same.
The FFADO source needs to be the driver and the sink the follower so
that captured data can flow to playback without delay.
Instead of starting a new thread for FFADO, use a timer and the data
loop to wait for FFADO. This is not so nice because we do blocking waits
on the data thread but then we can schedule the source and sink without
a context switch from FFADO. We use a timer so that we can set a timeout
period before starting the graph and catch xruns. The timer will be
restarted immediately when the graph completes and we can go back into
the FFADO wait.
FFADO Xrun should result in a new wait() call.
Handle channels better, use AUX for the channels when they don't match
the given positions.
Silence playback when we don't have a sink or sink data.
Stop and start FFADO when the sink/source pause/resume.
PIPEWIRE_CONFIG_NAME=client-rt.conf pw-cli -m load-module
libpipewire-module-ffado-driver '{ ffado.period-size=32 ffado.period-num=2 }
now gives 4.722ms latency measured with jack_iodelay, equal to JACK.
See #3558
For matching kctl without the numid you need to specify interface,
device, subdevice, name and index. So the current implementation can
only match kctls on IFACE_PCM, device 0, subdevice 0 and index 0.
Instead of adding all these matching parameters this commit fetches all
kctls attached to the audio card and match on the first occurred kctl
with matching name.
This should be sufficient for audio cards with unique kctl names. When
non unique names are needed, more kctl matching parameters needs to be
added.
DMABuf caps without concrete formats and modifiers don't map well to the
Pipewire negotiation process.
Introduce a new gst_caps_sanitize() helper function, where such cases
can be handled.
Gstreamer 1.24 added and largely switched to a new, modifier aware
DMABuf API. Unfortunately that breaks the existing DMABuf support in the
PW Gst element.
Add support for the new API.
JACK current_msec can be in MONOTONIC_RAW or MONOTONIC, depending on how
JACK was compiled (but it's likely MONOTONIC_RAW). PipeWire requires the
nsec field to be in MONOTONIC so take some time snapshots from both
clocks and apply a translation.
Also make sure we only get the nsec time from streams that exist.
See #3886
Make a method to get the current time to compare agains the pw_time-now
field. This is currently CLOCK_MONOTONIC but make this into a method
so that we can more easily change it later.
ALSA controls can only be opened on the card itself and will fail when
trying to open controls on the ALSA device. The device name we get may
or may not include the device suffix. If no suffix is present the
default device is 0 that's why currently it works on most audio cards.
But all other devices above 0 needs the suffix [1].
[1]
Device 0: hw:cardname
Device 0: hw:cardname,0
Device 1: hw:cardname,1
Device 2: hw:cardname,2
Device X: hw:cardname,X
We know in IRQ mode that any valid hi-res timestamp that the
driver privides will be before the wakeup event in pipewire.
This makes it so in IRQ mode we use better timestamping when possible,
which decreases jitter injected into the DLL, which in turn reduces
the amount of oscillations the resampler is exposed to.
Currently the HDMI output paths have jack mixers named "HDMI/DP" and
with append-pcm-to-name=true. However, most of the SOC audio drivers
are just named "HDMI" and don't add the ",pcm=N". Add these alternate
jack names to the HDMI audio path files so that jack detection will work
on these SOCs.
When we disable autoconnect, disable the timeouts as well. Otherwise the
user has to connect the stream within the 30 second timeout or get a
failure. With autoconnect we can reasonably assume there is a problem
when the stream is not connected after 30 seconds.
Fixes#3884
node.sync-group can contain a list of strings. When a node in the graph
sets node.sync = true, it will be scheduled with all of the other nodes with
common node.sync-group strings. By default all nodes are placed in
group.sync.0 except the freewheel and dummy driver.
Use this to ensure that all nodes are grouped under the same driver
(that is not the freewheel and dummy driver) as soon as the transport is
started so that the transport is visible to all nodes from the same
sync-groups. We also don't deactive the sync-group anymore for the node,
even if the transport is stopped, to avoid driver changes and transport
jumps.
When the node that activated the sync/transport is destroyed, things are
restored to their original state. Note that this is different from JACK
where starting the transport outlives the application and always needs
to be explicitly stopped again. We can't really do this (by default) because
it leaves the graph in an unnatural state with all devices in sync.
The reason for the node.sync-group is that it is possible to still have N
different subgraphs with a separate transports by manually specifying
the node.sync-group.
It's also slightly different from the node.group, that is always active.
The sync-group is something you only want to enable in specific cases
because it groups drivers together and enables adaptive resampling etc.
It's also possible to place this option in the jack.conf file to
automatically sync all devices and apps as soon as a jack app is started.
Fixes#3850