Commit graph

6195 commits

Author SHA1 Message Date
Robert Mader
934f6c7d1b systemd: Depend on dbus.service
Solution suggested by Xi Ruoyao.

The dbus user service is required for various features - the summary says:
'dbus (Bluetooth, rt, portal, pw-reserve)'

On session logout the dbus service gets shut down while the Pipewire one
relies on a timeout. If a user logs in again before PW timed out, the
later stays alive but doesn't handle re-connecting to the dbus service
of the new session, breaking the camera portal and potentially other
features.

Thus hard-depend on the dbus service (if enabled at build time) and thus
shut down together with it.

(cherry picked from commit 2625983a23)
2025-03-20 14:11:08 +01:00
msizanoen
f19fd8a735 systemd: Disable pipewire user services for root
The `access(2)` based multi-user mediation mechanism doesn't quite work
for the root user, which may cause it to conflict with a running
foreground user session. Prevent this by not running the user service at
all for the root user, which nobody should be doing anyway.

(cherry picked from commit 9bc29b4b37)
2025-03-20 14:11:01 +01:00
Taruntej Kanakamalla
d32259373b gst: deviceprovider: allow pulseaudio and exclude pipewire for audio
Don't hide pulsedeviceprovider so pulsesink/src are listed by the device provider
and exclude pipewire's audio devices in its deviceprovider.
Continue showing video devices in pipewiredeviceprovider, so that pipewiresrc is
listed for the video devices
2025-01-22 09:43:47 +05:30
Wim Taymans
e0d3092f0a filter-chain: initialize NULL data for each node 2024-10-22 10:23:15 +02:00
Wim Taymans
1c01c2a93f filter-chain: accumulate node param changes
Don't just look at the last set parameter to decide if the node
parameters changed but or all results together.

Fixes #4331
2024-10-21 10:08:23 +02:00
Wim Taymans
ee5a6f16f9 module-rt: first join and then free memory
First join the thread and then free the memory or else we might free the
memory while the thread is starting up and we crash.
2024-09-27 15:10:46 +02:00
Wim Taymans
cd201aca22 connection: fix fd leaks and confusion
When we receive a message with fds and we are at the end of the
buffer, we will call clear_buffer, which moves the next fds over the
fds of this message before we copy the fds into the message. This
results in the fd being leaked and the message using the fd of the next
message instead.

Avoid this by first copying the fds into the message and then move the
new ones over the old ones.

This fixes some wrong fds being used by clients.
2024-09-27 15:10:24 +02:00
Wim Taymans
1bdb01d6fd impl-link: also handle unprepared active links
An ACTIVE link going to < PAUSED is unprepared.
2024-09-27 15:04:58 +02:00
Wim Taymans
22bdd52db5 global: avoid recursive destroy calls
Fixes #4250
2024-09-19 09:49:58 +02:00
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
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
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
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
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
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
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
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
8eb93b4879 tools: queue the buffer again in all cases 2024-05-16 09:29:22 +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
Wim Taymans
7002fe8ac3 core: handle import errors better
Check for NULL when importing a buffer and log a message instead of
trying to deref the NULL pointer and crash.

Add some more logging to mem when importing a bad fd.

See #3998
2024-05-03 16:24:41 +02:00
Robert Rosengren
3c450008d5 gst/src: fix crash when current_caps is NULL
gst_pad_get_current_caps may return NULL and passing that into
gst_caps_is_equal may result in fatal critical log due to the
"g_return_val_if_fail (GST_IS_CAPS (caps1)" check. Fix by checking for
NULL to avoid this.

(cherry picked from commit 95127d8a18)
2024-05-03 13:35:24 +00:00
Robert Mader
6ce298ffde 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.

(cherry picked from commit e2e8cf7944)
2024-05-03 13:35:24 +00:00
Robert Mader
b53c93000c 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.

(cherry picked from commit 594e3fa09f)
2024-05-03 13:35:24 +00:00
Barnabás Pőcze
3cc0a405b2 pw-mon: fix type confusion in core event handler
All pw_core event handlers (`on_core_*()`) currently receive a pointer
to `struct data`, not `struct proxy_data`; as can be seen from the
`pw_core_add_listener()` call in `main()`.

Fixes: cacdcc1b62 ("pw-mon: add filter param to hide props and/or params")
Fixes #3997
2024-05-03 12:13:15 +02:00
Barnabás Pőcze
6c7dabb1e7 gst: fix stream params memory leak
Both the GPtrArray and its contents are leaked in case of success.
`pw_stream_connect()` copies the params as needed, so use `g_autoptr()`
to free the array and with it, its contents.
2024-05-03 12:12:59 +02:00
Wim Taymans
2d379bf908 gst: handle some more errors
The threadloop might fail to create because of missing plugins, so
handle that.

The context might fail to create because of some fatal config error or
missing plugin, handle that too instead of crashing.

See #3994
2024-05-03 12:12:35 +02:00
Barnabás Pőcze
f524271b81 treewide: fix errno assignments
Do not set `errno` to a negative value.
2024-05-03 12:12:05 +02:00
Wim Taymans
d810057310 module-rt: fix compiler warning
Fix warning about min/max potentially not being initialized.
2024-04-29 16:30:06 +02:00
Wim Taymans
3958eb5962 filter-chain: fix arguments of calloc 2024-04-29 16:30:06 +02:00
lunks
e757868cf9 combine-stream tag forward 2024-04-29 16:30:06 +02:00
Pedro Nascimento
99d342bd23 Add album to tag metadata 2024-04-29 16:30:06 +02:00
Wim Taymans
694409443f impl-node: avoid bitfield races
Move the bits that are used in the realtime thread away from the bits
from the main thread to avoid bitfield races. Move some fields in rt
structs to make it explicit that they are only to be modified from the
realtime threads.
2024-04-29 16:25:35 +02:00
Barnabás Pőcze
8a4ff447d9 treewide: fix some format string issues
Use the proper specifier, and cast to a known type where the type
is not guaranteed by any standard.

See #3975
2024-04-29 16:19:15 +02:00