Commit graph

12807 commits

Author SHA1 Message Date
Wim Taymans
feccb882b6 spa: add spa_json_begin
That combines spa_json_init() and spa_json_next, a common thing to do.
2024-09-16 09:50:31 +02:00
Philippe Normand
08057e0328 gst: deviceprovider: Signal default devices
By setting a "is-default" boolean property on the discovered GstDevice(s) the
application now gets a good hint of which device to select and use.

Fixes #4268
2024-09-11 13:14:26 +00:00
Philippe Normand
5ed170f6c4 meson: Fix typo in GStreamer dependencies mapping
Without this the device provider cannot be enabled when building PipeWire as a
GStreamer subproject.
2024-09-11 13:14:26 +00:00
Hans de Goede
2a6ba61264 spa: v4l2: Use systemd-logind to listen for access changes
There is a race between logind applying ACLs to allow the active session
of a locally present user access to devices with a udev uaccess tag
(like /dev/video# nodes) getting applied vs wireplumber/pipewire starting.

Wireplumber/pipewire are part of the (user) default.target, which gets
started as soon as a user logs in and systemd --user is started for that
user, where as logind only starts applying the ACLs after the gnome-shell
associated logind session has been created.

This race may cause pipewire to not see v4l2 video sources at login,
this can be reproduced with these steps:

1. sudo setfacl --remove-all /dev/video*
2. systemctl --user restart pipewire
3. Now wp-ctl status will not show any video devices
   (like if pipewire was started before the udev uaccess ACLs got applied)
4. Do a switch to another (test) user without logging out, e.g. in GNOME
   go to the top right system menu press the power on/off icon and select
   "Switch User..."
5. Switch back to your normal user. Run getfacl /dev/video0 this will show
   your user has access now.
6. wp-ctl status should show the camera now, but it does not.

Fix pipewire not seeing v4l2 sources in this case by making v4l2-udev
monitor systemd-logind session changes and redoing the access() checks
on /dev/video# nodes when the session changes.

Closes: #3539
Closes: #3960
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-09-11 07:26:41 +00:00
Hans de Goede
ab245947e5 spa: v4l2: Remove start_inotify() call from impl_on_fd_events()
The spa_loop_add_source() call for udev event monitoring which uses
impl_on_fd_events() is done from start_monitor() which also unconditionally
calls start_inotify().

Since start_monitor() already always calls start_inotify() there is no
scenario where start_inotify() has not been called yet when
impl_on_fd_events() gets called. So the start_inotify() call in
impl_on_fd_events() is redundant, remove it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-09-11 07:26:41 +00:00
Piotr Drąg
b1e8e218d6 Update Polish translation 2024-09-11 07:24:31 +00:00
Wim Taymans
f7110fbc77 module-raop: add ProcessLatency support
Intercept the Output Latency paran and parse it for later.

Use the computed latency as the ProcessLatency and expose this
as the ProcessLatency param and the updated Input latency.

Accept updates to ProcessLatency to modify the latency, which then also
updates the Input Latency param.

See #4270
2024-09-10 17:29:52 +02:00
Wim Taymans
e15244b1e1 params: add function to compare process_latency_info 2024-09-10 17:28:37 +02:00
Wim Taymans
1e5c86e1dc module-loopback: add ProcessLatency support
Improve the Latency reporting, we always report Input and Output latency
pairs.

Keep ProcessLatency on the capture and playback streams. The capture
stream process latency is reported as input latency and the playback
process latency as output latency.

Setting ProcessLatency on the capture stream (Sink), for example, will
propagate the added latency upstream. This would then instruct players
to send the audio earlier to compensate for the delay.

See #4270
2024-09-10 15:32:00 +02:00
Wim Taymans
b8c6bfae1a stream: Add support for setting ProcessLatency
Pass the ProcessLatency set on the stream to the implementor.
2024-09-10 15:32:00 +02:00
Arun Raghavan
d79b995e51 module-rtp-sap: Make sure we don't publish a null refclk
If the PTP refclk is not readable, we fallback to the stored ts_refclk,
which might be NULL. Make sure we check for this case.
2024-09-09 14:05:45 -04:00
Wim Taymans
5c2b5fa552 audioadapter: clear the handle as well to avoid leaks 2024-09-09 13:42:44 +02:00
Wim Taymans
ffed9763fd audioadapter: improve convert plugin loader
Use the converter in the current plugin when no plugin loader was given
to make the unit tests work.
2024-09-09 13:26:45 +02:00
Wim Taymans
ef40bb1d48 jack: emit buffer_size during jack_activate()
JACK emits the bufsize callback from the processing thread while
jack_activate() is called. Do the same with a blocking invoke.

The GStreamer plugin relies on this and when it reives the bufsize
callback later, it will error out.

Fixes #4260
2024-09-09 12:56:22 +02:00
Wim Taymans
36617fc833 jack: improve debug
Log current and target sample_rate and buffer_size
2024-09-09 12:30:42 +02:00
Wim Taymans
2762b8d98f videoadapter: sync with audioadapter 2024-09-06 17:35:34 +02:00
Wim Taymans
4d2cdd6da3 audioadapter: dynamically load the audio converter
So that we can plug in other implementations. Also handle the cases
where we can't load a converter.
2024-09-06 17:30:58 +02:00
Wim Taymans
b4c8627a62 audioadapter: improve format negiotiation
First try to pass the format of the converter directly into the
follower. This allows us to avoid conversion when it can be avoided.

Iterate all follower formats (not just the first one) to find something
that intersects with the converter formats.
2024-09-06 15:08:31 +02:00
Wim Taymans
0ef30aecab impl-link: silence some debug 2024-09-06 15:08:12 +02:00
Wim Taymans
9fb14be4e3 adapter: improve format parsing some more 2024-09-06 15:06:31 +02:00
Wim Taymans
c5a7f30a68 audioadapter: use generic audio format parsing
We don't need to use the raw audio format parsing functions, we can use
the more generic audio ones. This avoids some extra parsing for the
media type and subtype and will support compressed audio formats
as well when the converter handles this.
2024-09-06 14:46:34 +02:00
Wim Taymans
2cbcdbc579 videoconvert: add an ffmpeg based video converter
To activate:

PIPEWIRE_PROPS='{ video.adapt.converter = video.convert.ffmpeg }' build/src/examples/video-play

This makes it possible to start firefox with mjpg capture and then
video-play and it will decode the mjpeg transparently. Works for other
incompatible video formats as well, as long as they can be mmapped.

Ideally this should use something GPU accelerated and this is what the
vulkan converter will do.
2024-09-06 12:27:02 +02:00
Wim Taymans
b57375ba85 stream: enable videoadapter in all cases
It works fine without an explicitly selected converter.
2024-09-06 12:25:20 +02:00
Wim Taymans
7b30e515be videoadapter: sync with audio adapter
Try to passthrough the converter format to the follower when we can
before negotiating a conversion.

Try to convert between all follower formats instead of just the first
one.

When enumerating the port params, first enum the follower formats and
then the conversion formats.
2024-09-06 12:17:36 +02:00
Wim Taymans
f6803d4c03 audioadapter: pass the config mode around
When we are working in convert mode, configure the converter to convert
mode as well instead of DSP.
2024-09-06 11:20:25 +02:00
Stefan Ursella
189f2ec95b alsa-pcm: unlink pcm when driver is changed to a different pcm
We have to unlink pcms when they are linked to a driver from
a different pcm.

When a playback and a capture pcm is linked and we start
the playback pcm and the capture pcm later this can leads
to a 'EPIPE' error on the capture device.

...
spa.alsa: hw:3,0c: snd_pcm_start: Broken pipe
...
2024-09-06 08:42:20 +00:00
Wim Taymans
7036fc76e0 audioadapter: handle port flags better
Save the convert and follower port flags and use them in buffer
allocation.
2024-09-05 12:26:30 +02:00
Wim Taymans
1751575fc2 global: avoid recursive destroy calls
Fixes #4250
2024-09-04 18:05:29 +02:00
Wim Taymans
37eef2cf23 v4l2: queue dropped first buffer again
When we drop the first buffer to avoid timestamp problems, queue it
again in the driver or else we will not be able to dequeue is again
later and we will be running with a buffer less.
2024-09-04 16:57:07 +02:00
Wim Taymans
f22206165a format: SPA_POD_Fraction takes a pointer to a fraction 2024-09-03 18:07:12 +02:00
Wim Taymans
cbbf37c3b8 audioadapter: move some checks around
Move the check for the follower==target to the negotiate functions.

Refer to the target when doing operations. The converter reference
is just some internal element that may or may not be active at the
moment. If we have multiple converter elements, the current active
one will be in target.
2024-09-02 15:18:29 +02:00
Wim Taymans
82e4b9a213 audioadapter: remove redundant statement
The same check is done a little later.
2024-09-02 11:51:40 +02:00
Wim Taymans
c84cf9a9d4 impl-link: handle errors better
Keep the original sequence number of the port_set_param(Format) and
port_use_buffer() calls around. When they produce an error, we will
get an error with the same sequence number.

When the sync completes, check if we got an error for the pending
operation and return that as the result.

We then also mark the link in error. We don't mark the port in error
because that is not really the case.

This should make the link error when negotiation of format or buffers
fails instead of silently continuing.
2024-09-02 10:04:05 +02:00
Robert Mader
d59158529b libcamera: reset ringbuffer when clearing buffers
Keeping the ringbuffer state around resulted in a high chance of
using wrong buffer IDs for consequent streams, causing various issues.
2024-08-30 06:49:17 +02:00
columbarius
4d33ccf89a videoconvert: Start dummy plugin in passthrough mode
Since the dummy plugin can't process buffers, we should configure the
adapter to use passthrough mode  for now, instead of requiering the user
to do it manually.
2024-08-29 14:00:51 +00:00
columbarius
ec380b17e7 client.conf: Search videoconvert spa plugin 2024-08-29 14:00:51 +00:00
columbarius
17207038ea videoconvert: Add dummy plugin 2024-08-29 14:00:51 +00:00
Nedko Arnaudov
6f88b8bf68 jack: Implement jack_get_client_pid() 2024-08-29 14:23:01 +02:00
Nedko Arnaudov
fc25adc825 jack: make jackctl_server_close() succeed (still dummy) 2024-08-29 14:22:58 +02:00
Nedko Arnaudov
b2508b1d2b jack: make jackctl_server_stop() succeed (still dummy) 2024-08-29 14:22:55 +02:00
Nedko Arnaudov
80679c45be jack: Fix crash when pw_context_connect() fails in jack_client_open() 2024-08-29 14:22:52 +02:00
Nedko Arnaudov
3539bc4bed jack: add jackserver.pc 2024-08-29 14:22:49 +02:00
Nedko Arnaudov
d85c6212b3 jack: set current pipewire version in jack.pc file
jack[server] version has 3 for major
and pipewire's "1000*major + 100*minor + micro" as minor version
2024-08-29 14:22:46 +02:00
Wim Taymans
0ecac098c7 modules-netjack2-driver: add source.ip and source.port
Instead of binding the socket to 0.0.0.0 with port 0, make some config
options source.ip and source.port to configure this. This makes it
possible to bind to other interfaces or to use a fixed port for the
data messages.

Fixes #4144
2024-08-29 12:44:53 +02:00
Wim Taymans
5fff2c47a6 modules: improve docs some more for snapcast-discover
Fixes #4243
2024-08-29 10:18:36 +02:00
Arun Raghavan
292d6f5ca2 module-rtp: More u64 format fixes
Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4241
2024-08-28 21:55:15 -04:00
Wim Taymans
0956fc0884 tools: try to parse float values better
First try to parse the float value as a JSON number and then fall
back to atof to get the locale dependent variant.

This transparently makes things work with values such as 0.5 and 0,5.

Fixes #4234
2024-08-28 16:49:28 +02:00
Wim Taymans
a77a6f3959 modules: for format string for u64
Fixes #4241
2024-08-28 16:21:30 +02:00
Wim Taymans
b710cd03d3 jack: use pipewire version for minor/micro/proto
Use the pipewire header version for the minor/micro/proto in the
jack version. That way the jack version will increment and we can
easily see what pipewire version it was compied with.
2024-08-28 15:50:40 +02:00
Wim Taymans
5170724be4 docs: document negotiation of explicit sync 2024-08-28 11:43:38 +02:00