Commit Graph

12409 Commits

Author SHA1 Message Date
columbarius 2010fa1349 vulkan: Name params 2024-04-08 20:24:30 +00:00
Wim Taymans 34c8322986 impl-node: count missed wakeups as xruns 2024-04-08 17:02:20 +02:00
Wim Taymans 8ce5211a64 impl-node: run recovery cycle immediately
There is no reason to use the fd to schedule process_node, we can call
it directly when we detect an underrun need to complete the cycle with
whatever data made it to the driver.

This avoids starting the graph while the process_node is running and
avoids some stuttering.

See #3937
2024-04-08 15:58:38 +02:00
Pauli Virtanen 47c080496f CI: fix pages build stage
build_on_fedora_html_docs needs to be on earlier stage than pages so
that it can find the artifacts.
2024-04-06 11:17:12 +03:00
Arun Raghavan e4da3b95f5 alsa-pcm: Fix copy-pasto while listing ctls
Can cause a crash on startup under some circumstances.
2024-04-06 07:25:39 +00:00
Arun Raghavan 6c348e0600 ci: Avoid running pages build on merge requests 2024-04-05 11:49:41 -04:00
Arun Raghavan ff95fcd901 ci: Switch only/except to rules
Only and except are deprecated, at least don't seem to be working for
the pages job.
2024-04-05 11:48:19 -04:00
Arun Raghavan dedb086148 ci: Make syntax highlighting a bit happier
At least neovim's YAML parser doesn't like the ' ' without a leading
space.
2024-04-05 11:48:19 -04:00
Wim Taymans cb716bcce7 impl-node: set_io on the port mixers 2024-04-05 15:55:12 +02:00
Wim Taymans e9f4b55eb2 impl-node: set info.id as well
This is updated from the clock id a little later but we need it earlier
in the initialized event.
2024-04-05 15:53:13 +02:00
Wim Taymans 060052206f impl-node: add pw_impl_node_set_io()
Implement pw_impl_node_set_io() and do all the things that need to be
done in it, such as taking the clock.id, checking for driver etc.

We can then remove some code that tries to reimplement this, most
notably in the remote-node (where it was missing updates to the
target_rate and target_quantum and maybe related to #3845.
2024-04-05 13:16:46 +02:00
Wim Taymans 74de723ecc impl-node: improve node activation
Only activate the nodes when it was not-triggered, do this check with an
atomic compare-and-swap so that we only activate a node once.

We might be able to use this later to make sure that we resume the
untriggered peer nodes when we remove a node from the graph.
2024-04-04 22:01:44 +02:00
Wim Taymans 9cb4d820d5 impl-node: don't report xrun when pending <= 0
We might decrement too much but that would mean the driver was triggered
at some point and we don't really have an error.

Improve some debug
2024-04-04 22:01:01 +02:00
Wim Taymans 4db96d2197 impl-node: fix debug of do_move_nodes
Pass the old driver around so we can use it in debug. The new driver is
the one set in node->driver_node.
2024-04-04 21:00:50 +02:00
Wim Taymans 0633be3c12 node: add a cycle counter to the position
So that we can count the number of times the graph is scheduled.
2024-04-04 20:47:43 +02:00
Wim Taymans f366167278 settings: remove link.min-buffers option again
The min should always be 1. We have other ways of bumping the number of
buffers to 2, like the ASYNC allocation flag which we can set if we are
also doing some async scheduling. We could make this an option later.

Otherwise, we would also allocate 2 buffers by default between the mixer
and the node, which is unnecessary.
2024-04-03 15:27:05 +02:00
Wim Taymans dbedd09d42 settings: add link.min-buffers option
Add link.min-buffers option to set the minimum amount of buffers to
create for links. Set this by default to 2 because we really need two
now in case the sink xruns and does async mixing.

Make this an option because in low-memory cases and when xruns are not
expected, we can set this to 1.
2024-04-03 15:02:30 +02:00
Wim Taymans 5829276dbb client-node: fix array length debug 2024-04-03 13:29:27 +02:00
Wim Taymans a01a33aa75 impl-node: improve xrun handling
To check if the driver was not completed, check the pending state
instead of the status. This is more correct and we can do this a little
smarter by swapping the current state with 0 atomically.

When we detect a non-zero pending state, wake up the driver node.
Because we atomically swapped 0, we are the only ones doing this and it
will make the node process whatever was in the input ports instead of
underrunning.

Running 2 apps outputting to a sink and pausing one will still play the
output of the other one, this way.

See #3509
Fixes #3937
2024-04-03 11:18:46 +02:00
Wim Taymans 208a343d9f module-ffado: add ffado.rtprio and ffado.realtime
Add two properties to control the realtime ffado thread and its
priority.

See #3558
2024-04-03 09:30:38 +02:00
Wim Taymans 986de92521 buffers: add support for mandatory metadata
Add a SPA_PARAM_BUFFERS_metaType in the Buffers object. This contains a
bitmask of the mandatory metadata items that should be included on a
buffer when using this Buffers param.

Make the buffer allocation logic skip over the Buffers params that
require unavailable metadata.

This can be used to, for example, enforce specific metadata to describe
extra buffer memory (such as the meaning of generic file descriptors).

One such use is the explicit sync, where an extra buffer data is needed
for the sync fd along with metadata that contains the sync_point.
2024-04-02 12:28:21 +02:00
Wim Taymans a5c8100666 buffers: do some cleanups
Parse the metas right after we fixate the params and collec them in the
metas array. We don't have to loop twice and then we can simply pass the
prepared metas to alloc_buffers.

In case there are multiple Buffers params, take the first valid one and
ignore invalid ones.
2024-04-02 12:28:16 +02:00
Wim Taymans f3fe20bdde buffer: add GenericFd memory type
Add a Generic fd type. These could be eventfd or timerfd, the meaning
can depend on extra metadata.
2024-04-02 12:28:09 +02:00
Wim Taymans 77f3b7f6e4 examples: set the MAPPABLE flag for MemFd 2024-04-02 12:28:01 +02:00
Wim Taymans 2f8740dee8 mem: add a PW_MEMBLOCK_FLAG_MAPPABLE flag and pass it around
This flags means that the fd can be mmaped without special handling. It
is the equivalent of the SPA_DATA_FLAG_MAPPABLE. Refuse to map memory
that is not mappable.

Make sure we make all allocated MemFd memory MAPPABLE by default. We can
then remove the stream and filter special handling for MemFd types and
just check the more generic MAPPABLE flag.

Make one exception when a client uploads MemFd buffer memory. We must
manually set the MAPPABLE flag for MemFd to make things backwards
compatible.
2024-04-02 12:27:58 +02:00
Wim Taymans 45984fef77 stream: only unmap data that was mapped and mappable. 2024-04-02 12:27:17 +02:00
Wim Taymans 0b42ec714d stream: handle node.name fallback better
If we don't have extra properties, set the node.name to the stream
name if it was not otherwise present.
2024-04-02 12:26:44 +02:00
Adam Gensler 63af3a4b5c Update 90-pipewire-alsa.rules with support for Astro Mixamp Pro TR. 2024-04-01 18:31:10 +00:00
Pauli Virtanen 5ae0dfb239 bluez5: bap: determine SDU interval from codec frame duration
BlueZ API as BAP Server gives us the ISO interval, instead of the SDU
interval, in the MediaTransport.QoS.Interval property.  They are not
necessarily the same. What we need is the SDU interval.

The SDU interval is the interval between packets the encoder outputs, so
it is determined by the codec configuration, and for LC3 is equal to the
frame duration.

Add codec method get_interval() that returns the correct interval, and
use it in iso-io.
2024-04-01 19:13:01 +03:00
Pauli Virtanen b9ac79e99a bluez5: bap: no need to check for mtu, kernel fragments as needed
It's not necessary for ISO SDU to fit into the adapter MTU, as kernel
will fragment the packet as needed.

Remove MTU checks.
2024-04-01 15:23:32 +03:00
Pauli Virtanen d02cec53c6 CI: put docs from both 1.0 and master on pages 2024-04-01 07:16:24 +00:00
Robert Mader bd5cc52c5c libcamera: add camera rotation property on nodes
Like the location, the orientation is a static property of libcamera
devices. While the rotation is already exposed as buffer transform,
knowing the property can be handy for applications in various ways.

See also: cd8ac5c1a ("libcamera: add camera location property on nodes")
2024-03-31 13:24:19 +02:00
Robert Mader e2e8cf7944 gst/src: Avoid unnecessary renegotiations during streaming
Some clients like many camera apps, including Cheese or Snapshot,
trigger a lot of unnessecary renegotiations. While arguably that should
be solved on a Gstreamer level, we can help out by checking if the
preferred new caps are the same that are already in use and skip the
renegotiation in this case.

This allows several apps to e.g. take pictures without a slow and heavy
stream restart.
2024-03-31 11:03:13 +00:00
Robert Mader 594e3fa09f gst/src: Cleanups for src_negotiate()
Using `g_autoptr` and related modern helpers more often makes
the code smaller, easier to follow and maintain.
No behavior changes intended.
2024-03-31 11:03:13 +00:00
Robert Mader 1a2fee260b v4l2: Drop the first frame after camera startup
A quite big number of UVC cameras - due to firmware or kernel driver
issues - have bad timestamps of the first frame, confusing clients
like pipewiresrc.
Drop the first frame, as this seems to be the most reliable workaround
for the time being.

Closes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3910
2024-03-30 14:14:44 +01:00
Pauli Virtanen a9911f68a0 client-node: free port io memmap also if port gone
clear_port() clears all struct mix and removes the port, and can occur
before port io is set to NULL.  In this case the port memmaps are not
freed, and are leaked until client pool closes.

Fix by freeing the old io memmap when setting io to NULL, also when the
port was already cleared, so that the memmap lifecycle is the same as
that of the IO.
2024-03-29 20:39:13 +02:00
Robert Mader cc0f7596d6 gst: Always use Choice-pod for modifiers
In order to follow the documentation more closely. Also restructure the
code a bit to make it easier to follow.

See also: e3227b2b5 (gst: simplify modifier extraction)

Fixes: f1b75fc6f (gst: Add support for DMA_DRM / explicit modifiers)
2024-03-28 18:45:13 +01:00
Wim Taymans af310523db spa: improve null-audio-sink channels
We can just update the channels in the props, we don't need an extra
property that can go out of sync with the channels.

See #3931
2024-03-28 17:11:16 +01:00
Wim Taymans cddea858d9 context: add context.modules.allow-empty property
false by default, when true, no warning will be logged when the
context.modules in the config is empty. This can be useful when the
application wants to load all the modules itself.
2024-03-28 17:08:33 +01:00
Wim Taymans d0c9d2f99d conf: only count modules, objects and exec when added
We don't actually do anything when the name, factory or path is NULL so
don't count this as an action.

Commenting out these keys is a usual way for commenting out complete
sections.
2024-03-28 17:00:56 +01:00
Wim Taymans 8351a17197 conf: add more error checks
Fail when something goes wrong when adding spa-libs instead of silently
ignoring it.
2024-03-28 17:00:18 +01:00
Wim Taymans e3227b2b5d gst: simplify modifier extraction
spa_pod_get_values() handles both single values and Choice values and
turns the single value into a None choice.

Check that we have a None or Enum choice because we don't handle
anything else.

See !1952
2024-03-28 16:09:18 +01:00
Robert Mader 8848c7e792 gst: Re-enable handling of single long modifiers
A peer may announce support for a single modifier, in which case it may
not use a choice-pod. And while the documentation in `dma-buf.dox`
requires modifiers to always be announced as `SPA_CHOICE_Enum`, this has
been supported in the past - as well as matching Pipewire conventions.

Thus, in order to not break existing clients not crash, reintroduce
handling of modifiers as a single long.

Fixes: f1b75fc6f (gst: Add support for DMA_DRM / explicit modifiers)

Solution suggested by Barnabás Pőcze <pobrn@protonmail.com>
2024-03-28 15:09:34 +01:00
Wim Taymans d682d8c5aa properties: rework properties
Handle allocation errors better, propagate the errors to the caller.

Avoid doing some useless work updating the dict, do this only after we
have done adding all the items when creating and copying.

Make update_string keep a temp array of updates and only apply the
updates when error checking was enabled and there was success. This
makes it possible to parse the JSON string only once.

Fix some of the lookup logic. We can just use spa_dict_lookup() and
spa_dict_lookup_item(), we don't need the index.
2024-03-28 12:37:07 +01:00
Wim Taymans 29ff3f196c filter-chain: debug SOFA error codes better 2024-03-28 09:27:04 +01:00
Wim Taymans 6d4f255ae9 filter-chain: report more parsing errors 2024-03-28 09:16:15 +01:00
Wim Taymans 66b8cd3e32 json: fix SPA_JSON_STATE
It should copy the state as well or else parsing will fail.
2024-03-28 09:14:18 +01:00
Pauli Virtanen 27ccf32030 spa: fix spelling 2024-03-27 18:42:31 +02:00
Pauli Virtanen 3e99a0e839 spa: deal with non-null terminated strings in spa_error_location
Add len field to indicate number of valid characters after location.
2024-03-27 18:36:06 +02:00
Wim Taymans a0af514581 context: make error line debug a little better
Make a line to the ^ so that it is more visible. Spell out column
completely. Make the sizes a little smaller to avoid awkward gaps.
2024-03-27 16:23:38 +01:00