Commit graph

11814 commits

Author SHA1 Message Date
Pauli Virtanen
9419d458d1 doc: sync with master branch
Pick relevant doc updates.

doc: minor documentation improvements
doc: add options to change what /usr and /etc paths are shown
2024-03-17 14:44:47 +02:00
Arun Raghavan
e3fc41bf41 spa: alsa: Read ctl events instead of doing a global diff
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.
2024-03-15 12:20:38 -04:00
Wim Taymans
f2874ad1c2 1.0.4 2024-03-13 09:22:08 +01:00
Wim Taymans
9da78c4cd8 gst: only remove port once
The port has node_data set/cleared when it is added/removed to/from
the node. Make sure we only remove the port once to avoid a valgrind
error.
2024-03-12 17:44:56 +01:00
Wim Taymans
6e710ea39b jack: set the output buffer size correctly
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
2024-03-12 17:44:46 +01:00
Wim Taymans
a1e59effee module-ffado: add more port properties
Mark control ports so that wireplumber does not attempt to link them.
Clear ports before making new ones, don't free NULL ports.
2024-03-12 17:44:41 +01:00
Wim Taymans
436bd37342 settings: add default.clock.quantum-floor property
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
2024-03-12 17:44:25 +01:00
Wim Taymans
d801654836 module-ffado: disable pause on idle
Let the module run for a little longer until the session manager
suspends it.
2024-03-12 17:39:41 +01:00
Wim Taymans
863b3be343 audioconvert: add monitor.passthrough option
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
2024-03-12 17:39:33 +01:00
Wim Taymans
6d3790d794 module-ffado: copt link.group property 2024-03-12 17:39:11 +01:00
Wim Taymans
89d8e8b381 module-ffado: make the event buffer per port
Or else ports overwrite eachother.
2024-03-11 09:34:29 +01:00
Wim Taymans
383da7531c module-ffado: handle MIDI correctly
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.
2024-03-11 09:34:19 +01:00
Wim Taymans
4e4de27cf6 module-ffado: implement MIDI send and receive 2024-03-11 09:34:05 +01:00
Wim Taymans
365181b8af module-ffado: various fixes to make things work
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
2024-03-11 09:33:57 +01:00
Wim Taymans
4c75d4f660 stream: add pw_stream_get_nsec() to get current time
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.
2024-03-11 09:25:48 +01:00
Wim Taymans
b3c7dda96a jack: fix multiple midi input ports
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
2024-03-11 09:16:33 +01:00
Barnabás Pőcze
c649f4a328 pw-top: only check terminal size in non-batch mode
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
2024-03-08 18:22:28 +01:00
Antonio Larrosa
f3b20ae1e2 Specify "Audio" in gstreamer sink/src metadata to fix autodetect
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.
2024-03-08 18:22:08 +01:00
David Turner
e5c810c0fa Add SOC-style jack names to HDMI audio paths
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.
2024-03-01 13:55:34 +01:00
Wim Taymans
4fba866676 gst: remove timeouts when autoconnect=false
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
2024-03-01 13:55:28 +01:00
Wim Taymans
b41e2391bd audioconvert: handle invalid ports better
Keep track of the valid ports and don't emit port info for
invalid ports. When a listener is added while the ports are being
created, it is possible that the ports are still NULL or invalid.
2024-03-01 13:54:29 +01:00
Wim Taymans
8942b74c18 audioconvert: handle port remove
The info is NULL when the port is removed, don't crash on that.
2024-03-01 13:53:56 +01:00
George Kiagiadakis
71ae3df6f2 pw_context_parse_conf_section: use the conf argument instead of the context's conf
The conf argument was unused before, but it is correctly populated
using the context's conf in pw_context_new(), so the code behaves
the same effectively.

This allows parsing standard conf sections from other configuration
sources, as long as the sections are placed in a dictionary.
2024-03-01 13:53:44 +01:00
Wim Taymans
e62ab00f83 stream: FORCE_RATE should just contain the rate 2024-03-01 13:53:22 +01:00
Wim Taymans
0b75a3bed7 jack: FORCE_RATE should just contain the rate 2024-03-01 13:53:15 +01:00
Wim Taymans
6242dab47c jack: set global_mix safely
Keep track of the active number of mixer ports and update the global mix
io in sync with the data thread because that is where we will check the
state of the global mix io.

This is mostly important for output ports. When removing all links from
an output port, we first will clear all the mixer io and then remove the
global mixer with client_node_port_set_mix_info(). If we don't clear the
io before that, the data thread will be using that buffers as they are
cleared.

See !1915
2024-03-01 13:52:31 +01:00
Wim Taymans
5d965e1d68 jack: sync threads by pausing the core
When we clear the port io, pause the core until the invoke call
completed. This way we don't start processing other messages until we
have safely removed the port io.

Normally, when clearing a link on a port, first the mix io will be set
to NULL and then the format will be cleared, which clears the buffers
as well. By delaying the processing of the format clear until the io
is removed from the data thread we avoid taking away the buffer memory
from the processing thread prematurely.

When creating a link, first the format and buffers are configured and
then the io is set, which should be safe in all cases.

See !1915
2024-03-01 13:52:23 +01:00
Dimitrios Katsaros
67e0ebc336 alsa: Added handle for controlling htimestamp autodisable
You can now do this to permanently enable htimestamp:

pw-cli s 38 Props '{ params: [ api.alsa.htimestamp.max-errors: 0, api.alsa.htimestamp: true ]}'
2024-03-01 13:51:49 +01:00
Wim Taymans
d2e4ad1ae6 pulse-server: Make sure peer_sink name is filled
Use 'unknown' when we can't find the peer_name. Otherwise we will just
get a protocol error when the node.name is missing.
2024-03-01 13:51:25 +01:00
Jonas Holmberg
c51ced42b4 pipewire-alsa: Propagate errors from eventfd().
Propagate the error if spa_system_eventfd_create() fails. Also copy
errno before calling spa_log_debug() in spa_system_eventfd_create() to
make sure it is not overwritten.
2024-03-01 13:50:31 +01:00
Pauli Virtanen
030768ab8e doc: sync with master branch
Pick relevant doc updates.

doc: fix DoxygenLayout.xml for doxygen 1.10
doc: add reference docs + index for config and env variables
doc: add some more coverage
doc: move config man pages under config/
doc: add sections to index, clarify discussion of properties
doc: disable dot graphs in API docs again
doc: some updates
doc: fix up example dependencies in meson
2024-02-26 19:11:15 +02:00
Ruben Gonzalez
876c3f43ab logger: minor performance improvement to avoid syscall done by isatty 2024-02-19 09:01:34 +01:00
Dimitrios Katsaros
1f578e858c resampler: Only use copy when rate is 1.0
The rate we get from dlls can have a subsample precision. However,
the check for using process_copy is in sample precision. This means
that an adaptive stream will oscillate rather then lock into the
exact rate.
2024-02-19 09:01:30 +01:00
Dimitrios Katsaros
e25f7716b5 resample: use a float phase in update_rate
My making the phase into a float, the resampler can do finer grained
adjustments, which should improve the stability of adaptive
resampling
2024-02-19 09:01:22 +01:00
Wim Taymans
ffd9a8b892 conf: fix override directory order
We need to load and apply the overrides in the order:

If absolute config path, use only that.
If environment variable, use only that.
Else
 /usr/share/pipewire/*.conf.d/
 /etc/pipewire/*.conf.d/
 $HOME/.config/pipewire/*.conf.d/

Before this patch we would first apply $HOME and then /etc and /usr,
which is not expected.
2024-02-19 08:58:17 +01:00
Wim Taymans
791455c83f module-rtp: fix SAP header parsing for IPv6
If the originating source is IPv6, the A bit is set and the source is 16
bytes compared to 4 bytes for IPv4.

Fixes #3851
2024-02-19 08:57:29 +01:00
Pauli Virtanen
de617697be doc: sync with master branch
Update doc/ from master branch.

tutorial: fix s16 scale and add some docs
doc: add 'Configuration' page
doc: disable deprecated list
doc: fix some doxygen warnings
doc: put new pulse modules to right place
doc: filter some constructs that confuse doxygen
doc: Fix typo 'statis' -> 'static'
doc: include pipewire-pulse modules explanations also on man page
doc: add pw-v4l2.1 and spa-*.1
doc: add pw-reserve.1
doc: internals/access: update documentation vs current state
2024-02-16 21:53:23 +02:00
Wim Taymans
4a04d59c52 Update .gitlab-ci.yml file 2024-02-16 09:05:31 +00:00
Wim Taymans
0fba5537ed module-rtp-sink: improve source.ip default
Use the default source.ip from the same address family as the
destination.ip.

See #3851
2024-02-16 10:01:24 +01:00
Wim Taymans
346264f7a4 module-rtp: handle ipv6 sap.ip
Make a socket of the same address family as the address we're going to
bind it to.

When the source.ip is not specified, use the default in the same address
family as the sap.ip.

Probe the interface for addresses of the same family as the sap.ip.

Makes pactl load-module module-rtp-recv sap_address=:: work.

See #3851
2024-02-16 10:01:07 +01:00
Wim Taymans
f5c85478a7 meson: add options to set server and client RT priority
Make a rtprio-server and rtprio-client option. Leave the server
priority by default to 88 but lower client priority to 83. JACK
does something similar by setting clients to rtprio-server - 5.

Make module-rt use the client priority by default and bump the server
priority explicitly in the config file.

Leave the pulse-server to the default rtprio-client, there is no reason
to lower this any further because it is really just a regular client.

Bump the ffado packetizer thread to rtprio-server + 5 because that is
also what JACK does.

88 is still much higher than the value of 60 that JACK uses in
Fedora but now this is at least configurable.
2024-02-16 10:00:45 +01:00
Wim Taymans
119636cb3f alsa: split irq and timer wakeup functions
Because it's easy to do and avoids some runtime checks.
2024-02-16 10:00:35 +01:00
Dimitrios Katsaros
32f507d687 alsa: Reduce jitter in irq based software timestamping
We would timestamp within an unlikely block, which would introduce
additional jitter to current_time, which would have an impact on
the performance of the timer sensitive code.
2024-02-16 09:59:32 +01:00
Wim Taymans
4e24b6e265 pw-link: improve port and node names
don't leave the port and node names blank but fill in some defaults that
include the node/port id.
2024-02-16 09:57:43 +01:00
Wim Taymans
151a2f0dea spa: use errno values in warnings
Propagate the errno values from syscalls and use them in the warning
messages to give info about what is going on.
2024-02-12 10:55:14 +01:00
Dimitrios Katsaros
72b41e5067 metadata: Added context monitor for removed globals
impl-metadata would not monitor for globals being removed.
This would cause stale metadata to remain in the
store, causing future objects on the same ids to have invalid data.
2024-02-12 10:53:07 +01:00
Dimitrios Katsaros
b2c3ee5d8d metadata: handle removed globals in impl 2024-02-12 10:52:54 +01:00
Gleb Popov
d1b1202592 Use portable shebang in input-filter-h.sh 2024-02-12 10:52:41 +01:00
Gleb Popov
6f7be356f5 FreeBSD compatibility for module-rtp-sap 2024-02-12 10:51:50 +01:00
Gleb Popov
86ae379e55 Fix building module-netjack2 on FreeBSD 2024-02-12 10:51:41 +01:00