Commit graph

11886 commits

Author SHA1 Message Date
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
Lukas Rusak
1b115eaf31 alsa-pcm: don't force quantum for iec958 formats
This fixes an issue introduced in 771f71f622
where the quantum is forced and may break applications the specify their
own quantum.

Signed-off-by: Lukas Rusak <lorusak@gmail.com>
2024-05-03 12:10:54 +02:00
Pauli Virtanen
d3980f7cef journal: prepend code location to messages at debug log levels
Debug and trace log messages are often written based on the stderr
logging, where code location is always visible.

journalctl does not show the code location without extra tricks,
which makes user-submitted debug logs from journal more cryptic.

Make journal log more similar to stderr logs by prepending the code
location and log level in the log message when the log topic
level is >= DEBUG.
2024-04-29 16:30:06 +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
Wim Taymans
a7a0e2072e conf: warn when match actions are missing 2024-04-29 16:17:34 +02:00
Stefan Ursella
0f0c9e8995 module-protocol-simple: handle 'node.name' property 2024-04-29 16:17:16 +02:00
Wim Taymans
976764514f module-ffado: only start after ports are configured
Don't start yet when the ports are pending configuration.

See #3968
2024-04-23 11:16:40 +02:00
Wim Taymans
594d255c5e context: fill basic properties early
So that we can use them in match rules, such as the application.name
etc.
2024-04-23 11:16:40 +02:00
Pauli Virtanen
cf646fb4dd combine-stream: fix latency-compensate with resample.disabled=true
When resample.disabled=true, which is now the default, Format has zero
rate, so latency buffers get zero size. The rate in this case is the
graph rate.

Fix by just using the delay in samples, as all streams must in any case
run at same rate for the combining to work.

Fixes: bff252ce60 ("combine-stream: actually make use of resample.disable")
2024-04-23 11:16:40 +02:00
Wim Taymans
a5727432c9 profiler: remove unused data-loop 2024-04-23 11:16:40 +02:00
Wim Taymans
5066ea9a72 v4l2: fix printf format 2024-04-23 11:16:40 +02:00
Ashok Sidipotu
7728586601 spa: v4l2: encode device id into a json array 2024-04-23 11:16:40 +02:00
Ashok Sidipotu
4c19da1127 spa: libcamera: encode device ids into a json array 2024-04-23 11:16:40 +02:00
Wim Taymans
aefe407d79 impl-port: avoid doing work when the port is destroyed 2024-04-23 11:16:40 +02:00
Wim Taymans
f65dd4e515 impl-port: use 0 size when clearing IO 2024-04-23 11:16:40 +02:00
Wim Taymans
edc4c856b7 stream: log a warning when media.class and direction mismatch
Fixes #2493
2024-04-23 11:16:40 +02:00
Wim Taymans
e9f0638a70 module-loopback: only enable delay with valid rate and channels
Or else we can't calculate the required delay buffer size and we might
even end up with a double free.

Fixes #3748
2024-04-23 11:16:36 +02:00
Wim Taymans
98f9529147 alsa: fix race when updating the eventfd
The eventfd is read/written from/to the data thread and the main thread
concurrently with the update_active() function.

Use an atomic compare and swap to make this update atomic and avoid an
inconsistency between the active boolean and the eventfd. This could
result in the eventfd being unsignaled while the active flag was true
and the application receiving a timeout and XRun in its poll loop.

Fixes #3711
2024-04-16 09:57:12 +02:00
Wim Taymans
17a2c21573 audioconvert: also clamp monitor volume to min/max
When we set a min/max value, also clamp the monitor volume to it.

Fixes #3962
2024-04-16 09:56:48 +02:00
Pauli Virtanen
bf148d59cd combine-stream: actually make use of resample.disable
resample.disable was made to default to true, but copying it to stream
properties was forgotten so it didn't have any effect. Make sure to copy
it.

This will also prevent different input/output streams from negotiating
to different rates, which would result to broken audio since we are just
passing sample data through.
2024-04-16 09:55:38 +02:00
Wim Taymans
a2287be601 1.0.5 2024-04-15 09:33:15 +02:00
Wim Taymans
b72ead1dea spa: handle empty values better
Make sure the properties are not empty before trying to access them.
2024-04-10 13:19:23 +02:00
Wim Taymans
b5284791fc v4l2: handle empty properties gracefully
When a property is not found or is empty, go on to the next format
instead of failing.

See #3959
2024-04-10 11:10:20 +02:00
Wim Taymans
28ab18ddd4 client-node: pass the right object to functions
These functions are not really used so not currently a problem.
2024-04-10 11:10:10 +02:00
Wim Taymans
822b8114b5 stream: only unmap data that was mapped and mappable. 2024-04-02 13:30:36 +02:00
Wim Taymans
ecb35b976f 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 13:30:20 +02:00
Adam Gensler
582dcf773d Update 90-pipewire-alsa.rules with support for Astro Mixamp Pro TR. 2024-04-02 13:30:02 +02:00
Pauli Virtanen
85ed6eb2b5 CI: put docs from both 1.0 and master on pages 2024-04-01 14:27:23 +03:00
Robert Mader
f9bac4889c 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-31 13:15:20 +02:00
Pauli Virtanen
88db0a9103 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-31 12:50:54 +02:00
Wim Taymans
3ea4193bf6 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-31 12:50:19 +02:00
Wim Taymans
6279d79339 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-31 12:48:31 +02:00
Wim Taymans
8d0f738882 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-31 12:48:22 +02:00
Wim Taymans
5cb7d4c019 conf: add more error checks
Fail when something goes wrong when adding spa-libs instead of silently
ignoring it.
2024-03-31 12:48:15 +02:00
Jonas Holmberg
64cc53cc38 module-echo-cancel: Don't call _run() when inactive
Call _activate() in the aec spa plugin before both capture and sink
streams are started and call _deactivate() after both capture and sink
streams are stopped, to make sure _run() is not called while the spa
plugin is inactive.
2024-03-31 12:38:48 +02:00
George Kiagiadakis
a66aa7ae84 bluez: print a nicer warning when the bluez service is not available 2024-03-31 12:38:39 +02:00
Samuel Thibault
048285af7f spa plugins: Include Linux headers on Linux only 2024-03-31 12:38:27 +02:00
Wim Taymans
3bab51ca73 conf: add some warnings when keys are invalid and ignored 2024-03-31 12:38:10 +02:00