Commit graph

12535 commits

Author SHA1 Message Date
Wim Taymans 8da8f90076 conf: add some warnings when keys are invalid and ignored 2024-03-25 14:28:43 +01:00
Wim Taymans dfe18ca996 filter-chain: improve json parsing error reporting
Warn when an invalid key is parsed instead of silently ignoring it.
2024-03-25 14:19:45 +01:00
Wim Taymans ac6011dfa5 module-rtp: save errno before doing pw_log_error
We can't assume the errno value won't be clobbered.
2024-03-25 13:21:42 +01:00
Wim Taymans 4ffd74ef46 module-rtp: handle state change errors better
Make a new function to set the rtp stream in the error state.

When we fail to start the stream, set the error state. Otherwise (like
when we try to use an invalid interface name) the socket create will
fail but the stream will still try to send data to the invalid socket.
2024-03-25 12:22:11 +01:00
Wim Taymans 6e7b893448 client-node: small cleanups 2024-03-22 16:48:29 +01:00
Wim Taymans 4db0811878 alsa: add option to skip the busy check
Makes the card exposed even if some of the pcms are busy.

Fixes #3914
2024-03-22 12:42:48 +01:00
Wim Taymans e2ad924cbb examples: add some more debug to video-play
Debug the latency param, debug the pts vs current time.
2024-03-22 11:31:05 +01:00
Wim Taymans 842ac9e110 v4l2: set latency on port
Use the duration of one frame as the latency.

See #3910
2024-03-22 11:15:10 +01:00
Wim Taymans 58d626fec8 log: init topic_init function
Fixes #3916
2024-03-21 17:28:50 +01:00
Wim Taymans e66bdb016a tools: print ??? when the quantum is unknown 2024-03-21 09:51:12 +01:00
Wim Taymans 832f7f5ba5 spa: a quick fix for compiling with -Werror=shadow
spa_exchange() is used in spa_clear_ptr() and spa_clear_fd() which
already use the _old_value variable. So make it use a slightly different
local variable name to avoid shadow warnings.

Fixes #3915
2024-03-20 10:06:44 +01:00
Wim Taymans a3eca706ce module-ffado: add some more debug
Add some code to dyanmically switch period_size but it seems to keep
crashing ffado no matter what I try.
2024-03-19 15:46:46 +01:00
Wim Taymans 61dbad2cf3 module-ffado: make sure we close and open when suspend
Rework some things so that we can actually completely close and reopen
the driver when suspending. Leaving the device opened but not streaming
causes trouble when ffado-mixer changes the settings in between.

Do this by first doing a probe to get the ports and streams and then
link those to the actual buffers when we start streaming.

Follow the graph rate and quantum so that we open with the right
settings, this makes pw-metadata work on the quantum and rate. It
requires a driver reopen so it might be slower.

Try to handle some errors better.

See #3558
2024-03-19 13:20:29 +01:00
Wim Taymans 0e380de809 conf: improve matching rules a bit more
Handle "null", null, !null, "!null", !"null" and "!\"null\""
matches, copy some docs from wireplumber about the rules and
add some more cases.
2024-03-18 17:53:44 +01:00
Wim Taymans c52c56621d utils: use memmove when src and dst can overlap
spa_json_parse_stringn() can be used when the strings source and
destination are overlapping so use memmove instead of strncpy to
avoid corruption of the strings.
2024-03-18 16:32:30 +01:00
Wim Taymans ce86b9a398 alsa: improve acp device/node object paths
Use alsa:acp: as the object prefix to make it different from the
alsa:pcm prefix when we are not using ACP.

Replace the card index in the object.path with the card_name, which
we try to construct from the alsa.id when it is available. This brings
the object.path in line with the alsa-pcm-device naming and adds the
user configurable id in the object.path to make it possible to
differentiate between identical devices.

Place the acp device index after the card_name instead of the unstable
device name (which depends on the alsa card number, which depends on the
kernel probing order).

This should make the object.path stable accross reboots for ACP and user
configurable with udev. With such a stable id, the other fields can be
made stable as well with custom rules.

See #3912
2024-03-18 11:41:37 +01:00
Wim Taymans aec07d974e acp: move acp_dict_lookup to public header 2024-03-18 11:41:01 +01:00
Wim Taymans 37a51533e0 acp: add more properties for the card
Use snd_ctl_card_info to set some more card properties such as the
alsa.id, alsa.mixer_name and alsa.components.

alsa.id is interesting because it is possible to use udev rules to set a
custom id, which is handy when you have two identical cards in the
system and want to assign unique ids to them.

See #3912
2024-03-18 10:59:23 +01:00
Charlie Li 2821b05d0b module-raop-sink: explicitly include <openssl/evp.h>
As part of LibreSSL's cleanup of removed ENGINE support, <openssl/x509.h> is no longer included in <openssl/engine.h>. <openssl/evp.h> was transiently included in <openssl/x509.h>, compared to <openssl/rand.h> for OpenSSL.
2024-03-16 14:39:00 -04:00
Steve Langasek 4af8b0f5a7 v4l2: unset _TIME_BITS in addition to _FILE_OFFSET_BITS
The v4l2 build unsets _FILE_OFFSET_BITS, which is not allowed when setting
_TIME_BITS=64.  Having verified that nothing in this module is sensitive to
64-bit time_t (none of the functions it intercepts handle time), we also
unset _TIME_BITS to allow this to build as before.

Signed-off-by: Steve Langasek <steve.langasek@canonical.com>
Reviewed-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-03-16 09:25:27 +01:00
Wim Taymans 2c0d73ab49 gst: handle latency in the pipewiresrc
Get the delay in the graph and subtract this from the cycle start time
to get the timestamp of the buffer.

Report this latency as well.

Fixes #30
2024-03-15 17:31:43 +01:00
Wim Taymans 1fe498560b gst: refactor some of the param handling
Clear the caps when the param is NULL.
2024-03-15 17:31:05 +01:00
Wim Taymans 2bd85e08cf gst: parse the audio rate from caps
Parse the audio rate from the caps and set this as the stream node.rate
property. This will try to switch the graph to this rate and avoids
resampling.

Rework some of the property handling.
2024-03-15 17:27:32 +01:00
Wim Taymans 9f74a31e9e include: install new header 2024-03-15 13:18:22 +01:00
Wim Taymans 9c072832f0 tests: cleanup correctly to avoid leaks 2024-03-15 13:08:58 +01:00
Wim Taymans c2ba66bef6 protocol-native: clean up security context on unload 2024-03-15 13:00:30 +01:00
Wim Taymans df50952f48 tests: add right include for close/unlink/pipe2 2024-03-15 12:39:20 +01:00
Wim Taymans 76ce2f77a4 test: handle running without a server
The security context test requires a running server, exit gracefully for
now when there is server running, like in the CI.
2024-03-15 12:25:30 +01:00
Wim Taymans 7e9e261fa6 conf: support property rules
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.
2024-03-15 12:10:41 +01:00
Wim Taymans afd0affd97 conf: handle !null checks 2024-03-15 12:10:40 +01:00
Wim Taymans 6c6046f5ac tests: update unit test for added field 2024-03-15 12:10:40 +01:00
Wim Taymans a69e2ecda5 gst: fall back to buffer time when no header
This at least sets some form of timestamp on the buffers.
2024-03-15 12:10:40 +01:00
Wim Taymans f0dcdf4d31 stream: add time field to pw_buffer
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.
2024-03-15 12:10:40 +01:00
Arun Raghavan 46e6fd2ae4 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-14 10:13:41 -04:00
Wim Taymans 8a1ed01923 protocol-native: update the properties correctly 2024-03-14 11:10:38 +01:00
Wim Taymans 9af26d1718 stream: improve the timing info
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.
2024-03-14 11:06:12 +01:00
Wim Taymans 1d8a96d240 stream: update some docs 2024-03-13 15:27:47 +01:00
Wim Taymans 69cc3832d4 tools: improve error reporting
Add better error reporting in the security context and pw-container.

Add manpage for pw-container.
2024-03-13 12:53:04 +01:00
Wim Taymans 81181e255f tools: add pw-container tool
This makes a new custom security context with the given properties
and runs the program in this context.
2024-03-13 12:53:04 +01:00
Wim Taymans 477c6e8e90 protocol-native: improve security context properties
Remove the engine_name, use pipewire.sec.engine in the properties. Make
some constants for this.

Document some more properties.
2024-03-13 12:53:04 +01:00
Wim Taymans d250f6932c protocol-native: don't allow recursive security context
Place the engine name in pipewire.sec.context and make sure that a
client with a pipewire.sec.context property can't make new contexts.
2024-03-13 12:53:04 +01:00
Wim Taymans e7846fc12a protocol-native: add security context API
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.
2024-03-13 12:53:04 +01:00
Wim Taymans c5e8da7247 protocol-native: add props to the sockets keys
Make it possible to set extra properties on the sockets created from the
config options with a props key.
2024-03-13 12:44:24 +01:00
Wim Taymans e86a68db3f gst: add a clock to gst pipewiresink 2024-03-12 17:36:50 +01:00
Wim Taymans 4437f6e000 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 16:54:50 +01:00
Wim Taymans 7a9dfc188a jack: improve midi buffer handling
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.
2024-03-12 16:41:59 +01:00
Wim Taymans ca4f9d4989 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 15:53:02 +01:00
Wim Taymans f86ea21b19 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 12:22:34 +01:00
Wim Taymans 84af13a10b 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 10:21:31 +01:00
Pauli Virtanen e784de3933 spa: use log topics everywhere
Use log topics properly everywhere, convert from "#define NAME".
2024-03-11 18:45:21 +02:00