Commit graph

11936 commits

Author SHA1 Message Date
Barnabás Pőcze
cf3e52c25c impl-link: fix error message memory leak
`pw_link_info::error` was previously not cleared when a link was destroyed,
leading to a memory leak if an error message had been set. For example,
if format negotiation fails, and as a result the link is destroyed.
2024-09-17 11:36:28 +02:00
Severin von Wnuck-Lipinski
55dc9c3c27 bluez5: backend-native: Handle AT+CCWA command
Claim that call waiting notifications are supported.
Required for some devices (e.g. Soundcore Motion 300),
as they stop sending commands if the reply to CCWA is not OK.
2024-09-17 11:35:54 +02:00
Wim Taymans
ba7656fcfd impl-node: include config.h to define HAVE_MALLOC_TRIM
It was previously not used..
2024-09-17 11:34:16 +02:00
Wim Taymans
a8db21862c alsa: restart the node on hw_param change
When we emit a new EnumFormat, the adapter will renegotiate a new format
that will be applied when we restart.

Fixes #3858
2024-09-17 11:18:43 +02:00
Wim Taymans
bc435dc6f3 audioadapter: recheck formats when EnumFormat changes
When the follower has new EnumFormat, make sure we recheck the formats
the next time the node is started.
2024-09-17 11:18:43 +02:00
Wim Taymans
29595ca7bf audioadapter: clear buffers when format is reconfigured
Always clear the Buffers when the format is reconfigured because they
depend on the Format.
2024-09-17 11:18:43 +02:00
Wim Taymans
ae3d11147f impl-node: only let the server send RequestProcess commands
When we emit the RequestProcess event from an exported node, don't
send the RequestProcess command to ourselves but let the server
decide where to send it to.
2024-09-17 09:19:43 +02:00
Wim Taymans
6189bf1e73 stream: only call early process for output streams
Input driver streams don't need their process callback called before
starting the graph, they will get their process callback called at the
end of the graph cycle. We were doing this for the rt case fine but not
for the non-rt case.
2024-09-16 18:35:08 +02:00
Wim Taymans
0f08f54ef3 thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads
instead of pthread_create.

Use this in jack instead of bypassing the thread utils create function,
which gives the wrong thread rt priority with rtkit.

Fixes #4099
2024-08-07 10:46:52 +02:00
Wim Taymans
7114e9a31a v4l2: Improve format and control enumeration
Use dynamic pod builder so that we can also build complex formats.

Make sure we zero the format before we parse it or else we end up with
potentially uninitialized values.

When ENUM_FRAMESIZES or VIDIOC_ENUM_FRAMEINTERVALS return EINVAL for the
first index, make a dummy result and continue with that. This will
trigger an intersect withe filter so that we end up with something valid
instead of nothing.

Handle 0 framerates without crashing.

See #4063
2024-08-07 10:44:26 +02:00
Wim Taymans
bc9eb76a6e v4l2: use a dynamic pod builder to handle larger PropInfo
The labels from the vivid driver need more space so use a dynamic
builder to make sure we can handle them.

See #4063
2024-08-07 10:42:29 +02:00
Hans de Goede
b79f77b73d spa: libcamera: Increase devices_str[] buffer size
Some complex camera pipelines, like the IPU6 can involve many /dev/video#
nodes (32 in the IPU6 case) and the current size of 128 chars is not enough
to hold all /dev/video# nodes in this cases causing SPA_KEY_DEVICE_DEVIDS
to get truncated, which in turn breaks the filtering of V4L2 devices which
are used by a libcamera driven camera in wireplumber.

Fix this by increasing the size of devices_str[] to 256.

This fixes wireplumber adding a bunch of non-function V4L2 video sources,
e.g. before this "wpctl status" outputs the following video sources:

Video
 ├─ Devices:
...
 ├─ Sources:
 │      90. ov2740
 │  *  115. ipu6 (V4L2)
...
 │     135. ipu6 (V4L2)
 │
 ├─ Filters:

After this fix the output is:

Video
 ├─ Devices:
...
 ├─ Sources:
 │  *   92. ov2740
 │
 ├─ Filters:

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-08-07 10:40:55 +02:00
Wim Taymans
0cfd576517 module-ffado: implement freewheeling
When freewheeling starts, pause the streaming and resume when
freewheeling stops. Also make sure we don't try to do any IO or
timeouts.
2024-08-07 10:40:55 +02:00
Wim Taymans
6a64442b73 module-ffado: separate rt booleans from non-rt 2024-08-07 10:40:52 +02:00
Wim Taymans
3da8c324be conf: increase priority of dummy and freewheel driver
We have various modules that set the priority higher than the dummy and
freewheel driver (ffado, netjack,...). This makes it impossible to use
the freewheel driver on them.
2024-08-07 10:32:06 +02:00
Wim Taymans
fa771af329 modules: use the right module name in the docs
Fixes #4172
2024-08-07 10:30:54 +02:00
Dylan Aïssi
d05efe03dc meson: allow fallback to find_library for readline detection
Fixes: 050a51aa (" meson_options: Add readline option")

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-08-07 10:30:45 +02:00
Wim Taymans
0f5147a67b pw-cli: support arbitrary large params and commands
Use a memstream to collect the arguments so that it can dynamically
allocate as much memory as necessary.

Use a dynamic pod builder to construct the pods so that they can be of
arbitrary size.

Fixes #4166
2024-08-07 10:30:31 +02:00
Wim Taymans
4825040b10 module-ffado: add some docs 2024-08-07 10:30:27 +02:00
Wim Taymans
0de37c52d4 module-ffado: keep the configured rate in sync with params
When we reconfigure rate, make sure we update the EnumFormat and Format
params with the new value.
2024-08-07 10:30:23 +02:00
Wim Taymans
a7796837a6 module-ffado: Improve samplerate and periodsize handling
Only set use the graph rate and duration when the ffado.sample-rate
and ffado.period-size properties are set to 0. Othersize use the
configure values.

Without this patch, it would just ignore the settings and always use the
graph rate.
2024-08-07 10:30:15 +02:00
Wim Taymans
99dcf94ad3 meta: add explicit sync metadata and data type
Change the GenericFd data type to SyncObj. It's probably better to
explicitly state the data type than to make something generic. Otherwise
we would need to transfer the specific fd type somewhere else and there
is no room for that in the buffer and the the metadata is not a good idea
either because it can be modified and corrupted at runtime.

Add the SyncTimeline metadata. This contains 2 points on two timelines
(SyncObj datas in the buffer). The buffer can be accessed when the
acquire_point is signaled on the timeline and when the buffer
can be released, the release_point on the timeline should be signaled.
2024-08-07 10:05:02 +02:00
Wim Taymans
350416768e 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-08-07 10:05:02 +02:00
Wim Taymans
67ef82f975 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-08-07 10:05:02 +02:00
Wim Taymans
dde45881d9 module-raop: remove unused deprecated header 2024-07-15 16:04:29 +02:00
Barnabás Pőcze
b8f296310f pw-dump: sync on metadata change so that changes are displayed soon
In order to show metadata changes when monitoring, a sync must be
triggered just like it is done for other objects, to make sure that
`dump_objects()` is called some time later and the changed metadata
objects are shown.

Otherwise metadata changes would never be displayed unless there
was a change to a different type of object, whose event handlers
do trigger a sync.

Fixes #4053
2024-06-18 12:45:28 +02:00
Wim Taymans
8d06e19100 jack: queue free of old mem in node_set_io as well
Avoid freeing the old io Position area before the data loop has managed
to get a pointer to it. Queue a free operation that will be executed
from the main loop after the data loop has the io area.

Fixes a crash when stressing jack clients to switch between drivers.
2024-06-18 12:45:09 +02:00
Wim Taymans
22d6065cda jack: don't call free_link from the data thread
We are not allowed to call free_link from the data thread because it
does free() and some pw_mem calls which should only be called from the
main thread.

To solve this, pause the core, queue a free_link operation on the data
thread, which will be scheduled after the previous remove_link operation
completes, free the link and then resume the core. Blocking and resuming
the core is necessary because we can't block for completion of the
invoke calls (the jack method is not allowed to block) and we must
ensure that nothing can happen with the memory (like reuse the mem_id)
before we have cleaned it up.

Fixes a crash in jack with create/destroy link stress.
2024-06-18 12:44:46 +02:00
Wim Taymans
b5cfbf058a jack: rename a function
Add/remove_link is more what this function does.
2024-06-18 12:39:11 +02:00
Wim Taymans
aa5625a470 jack: update the eventfd from the data loop
Also update the variables we use from the data loop.
2024-06-18 12:36:38 +02:00
Wim Taymans
458d2e7e02 module-ffado: keep track of transfered data
When for some reason we don't manage to transfer data from the source
or to the sink (timeout, scheduling problems..), try to do it when we
get a timeout to avoid xruns.
2024-06-18 12:36:07 +02:00
Jonas Holmberg
fed908694a profiler: Decrease memory usage
Make flush buffer initially smaller and increase it when needed.
2024-06-18 12:35:46 +02:00
Wim Taymans
5876eba0cf module-ffado: set next_nsec to something better
Add the duration of the period to the current nsec to get the next_nsec.
2024-06-18 12:34:28 +02:00
Wim Taymans
a3a2ac9d7c spa: fix compilation with -Werror=float-conversion 2024-06-18 12:29:10 +02:00
Wim Taymans
59fe89d41a 1.0.7 2024-05-24 11:12:36 +02:00
Wim Taymans
5ebb089bfa ffado: add priority.session property
It seems to be required to unselect it as default node in wireplumber.

Fixes #4023
2024-05-24 11:01:06 +02:00
Wim Taymans
3c9bd37fa1 acp: handle some errors better
Handle allocation failure and size overflow.
2024-05-24 11:01:06 +02:00
Pauli Virtanen
6ee9e62787 spa: fix integer overflows etc. in spa_pod_compare_value
Add macro SPA_CMP to do 3-way comparisons safely, and use it to avoid
signed integer overflows.

Fix also float/double comparisons (previously 0.1 == 0.8 since cast to
return type int).

Fix Id/Bool comparisons so they can return negative value.
2024-05-24 11:01:06 +02:00
Jonas Holmberg
9c1760a882 impl-port: update added flag from rt thread
Avoid trying to remove a port before it has been added.
2024-05-16 09:31:26 +02:00
Barnabás Pőcze
861578c4d5 pulse-server: client_queue_subscribe_event(): check message allocation 2024-05-16 09:30:50 +02:00
Wim Taymans
412b379138 jack: copy events to right offset
The larger events need to be copied into the target buffer at the same
offset as the source buffer or else we overwrite the header and make
a corrupt buffer.
2024-05-16 09:30:04 +02:00
Wim Taymans
8eb93b4879 tools: queue the buffer again in all cases 2024-05-16 09:29:22 +02:00
Wim Taymans
1b8b683a6d 1.0.6 2024-05-09 10:06:02 +02:00
Wim Taymans
37a12fab82 alsa: remove racy atomic operations
The atomic operations were used in an attempt to limit the amount of
wakeups done on the eventfd. It's however racy and causes trouble in
some cases.

Remove the atomic operations all together, it's probably not worth
optimizing this too much.
2024-05-07 10:11:50 +02:00
Pauli Virtanen
2335657343 bluez5: media-sink: keep one more buffer free
We delay the audio a bit to keep packet intervals equal, which keeps
some data in buffers.

In theory the calculation keeps one buffer free, but it doesn't
explicitly keep "extra" buffer space so in theory might flush too late
and next process() might not have free buffers.  However, as we encode
next packet right away this shouldn't really occur...

Try to keep one extra spare buffer free so that the flush time is
certainly early enough.
2024-05-06 18:21:33 +03:00
Pauli Virtanen
513495eaaa bluez5: drop queued data on node stop
Clear queued buffers when stopping consuming, to ensure that all buffers
are usable when we start again.

Do for A2DP as we already do for SCO.
2024-05-06 18:21:29 +03:00
Robert Mader
60deeb2555 spa: libcamera: fix RGB mappings
Libcamera formats are generally little-endian, matching DMA DRM
fourccs, while PW ones are big-endian. Thus we have to invert the
order.

Only RGB and BGR where tested, as these are the formats currently
supported by the software ISP. This fixes inverted red and blue in
Snapshot on the Librem5 and Pinephone (OG).

See also gstlibcamera-utils.cpp in libcamera.
2024-05-06 09:53:50 +02:00
Barnabás Pőcze
cc88712ea6 pw-dump: destroy all objects not just those matching the pattern
`registry_event_global()` creates an `object` object for every object,
not just those matching `data::pattern`. However, previously
`registry_event_global_remove()` only destroyed those objects
that matched the given pattern. Fix that by destroying
every object.

Fixes #4001
Fixes 47e1f38f03 ("pw-dump: also dump object removal")
2024-05-06 09:53:42 +02:00
Barnabás Pőcze
3a912cbbb3 pw-dump: fix string memory leak on error
`object::type` was not cleared in the error path. Fix that
by calling `object_destroy()`, which takes care of it.
2024-05-06 09:53:35 +02:00
Pauli Virtanen
bb54e32e8a json: fix high surrogate escapes
Surrogate escapes must add not or 0x10000, as the specified bits go up
0xfffff.
2024-05-06 09:53:08 +02:00