Commit graph

9865 commits

Author SHA1 Message Date
Wim Taymans
37439d2b73 pulse-server: add gsettings module
Uses a thread to monitor gsettings data. Loads and unload modules
based on gsettings.

This makes paprefs work.
2022-12-07 09:45:43 +01:00
Wim Taymans
89d4cafec4 pulse-server: fix module args 2022-12-06 19:02:02 +01:00
Wim Taymans
865d41b986 pulse-server: module does not depend on client
We don't need to pass the client to the module create and load
functions, they can work without a client.

The only place the client is used is to access the properties to make a
new connection to pipewire. This is also however not a good idea, we
should simply use the defaults used by the context or else a client
could set strange properties like remote.name etc for these internal
connections.

Also removing the dependency of the client will make it possible to load
modules from the startup script or other modules later.
2022-12-06 18:26:29 +01:00
Wim Taymans
80cb1d2566 acp: ignore_dB should be passed around to device
Don't only use the ignore_dB property for the profile sets but also when
setting up the mixer of a device, like pulseaudio does.
2022-12-06 13:39:45 +01:00
Robert Mader
2ed7afb76c gst: Implement SPA_META_VideoTransform support
Many Gstreamer elements support transforming buffers via the
`image-orientation` tag. Use it to implement support for the new
VideoTransform meta.

In order for Gstreamer pipelines to enable support for these tags
usually the rotate method has to be set to `auto` or `automatic`,
e.g. `videoflip method=automatic`, `glimagesink rotate-method=automatic`
or `waylandsink rotate-method=auto`.
2022-12-05 18:40:00 +01:00
Robert Mader
fa799aac86 libcamera: Implement SPA_META_VideoTransform support
libcamera can detect camera transforms/rotation, e.g. from the device
tree, and makes that information usable for clients via
`CameraConfiguration::transform`.
Advertise this information via the VideoTransform meta so Pipewire
clients can adjust their output accordingly.

Rotated cameras are common in mobile devices such as the Pinephone Pro,
which was used to test this feature.
2022-12-05 18:25:36 +01:00
Wim Taymans
9f2abea480 module-loopback: deactive both streams before destroying
First deactivate both streams so that they are not calling eachother
anymore and then destroy the streams.
2022-12-05 16:05:37 +01:00
Wim Taymans
bc2cf226d7 aec-webrtc: clarify comment
drift-compensation is not needed because PipeWire already does drift
compensation between all sinks and sources linked to the resampler.

See #2692
2022-12-05 12:01:23 +01:00
Wim Taymans
03f9466c5d audioadapter: improve PortConfig enumeration
When in passthrough mode and there is no converter, simply return
our own PortConfig parameter with our direction and passthrough mode.

Otherwise, use the PortConfig from the converter but filter out only the
PortConfig that matches our direction.

This fixes enumeration of PortConfig on the adapter.
2022-12-05 11:45:44 +01:00
Wim Taymans
5bda4b6a57 audioadapter: only accept PortConfig for the adapter direction 2022-12-05 11:45:10 +01:00
Wim Taymans
177479dfd1 audioconvert: improve some more AVX2 code 2022-12-05 09:37:29 +01:00
Wim Taymans
d6101d73e7 audioconvert: fix PortConfig enumeration
Enumerate what we can support in EnumPortConfig.
Enumerate what is configured in PortConfig.
2022-12-05 09:15:48 +01:00
Wim Taymans
4e4d76ccd0 audioconvert: use gather in AVX2 code 2022-12-04 20:38:35 +01:00
Wim Taymans
5b371048df stream: always try to recycle a buffer
Also try to recycle a buffer if the current buffer_id is invalid.
Ignore -EPIPE from the sender, just ask for more data. -EPIPE is when
the sende runs out of buffers so in that case we need to recycle one
as well.

Fixes #2874
2022-12-04 12:51:45 +01:00
Wim Taymans
dd420934ce impl-node: start driver node after followers completed
Wait for all pending Start commands from the followers to complete
before adding and starting the driver node.

This ensure that all links are set up and the nodes have received and
replied to the Start command and things can start without hickups.
2022-12-03 20:38:26 +01:00
Wim Taymans
a5f23224d1 impl-node: activate links immediately
Don't wait for the node to be added to the graph before we activate
the links to it.

We don't do the reverse for shutdown and the activation counters won't
actually be updated until the node is added.

Waiting can cause race conditions in some specific cases (see in
screen sharing unit test) because the driver node can start
pushing buffers before the link has sent the Buffer io area to the
ports.

With this fix, the receiver (input stream) will first trigger
the input link activation, then the Start command and then it will be
added to the graph.

This does not entirely fix the race conditions when starting. Ideally,
the driver node should wait until all pending Start commands of the
nodes in the graph have completed.
2022-12-03 20:35:07 +01:00
Frédéric Danis
90d00551b7 bluez5: sco-sink: Remove unused variable 2022-12-02 11:11:47 +01:00
Pauli Virtanen
9496078be5 bluez5: add bluetoothOffloadActive device prop for acquiring transports
Add a device prop that causes transports to be acquired.
2022-12-02 11:11:47 +01:00
Wim Taymans
99c150a613 stream: handle some invalid situations
Give an error when try to set more buffers than allowed.
Make sure we only queue buffers with a valid id.
2022-12-02 10:58:13 +01:00
Wim Taymans
0c50ccac87 jack: only process valid ports
In the data-loop we can check the valid flag safely to check if ports
are valid for processing.

See #2863
2022-12-02 09:46:05 +01:00
Wim Taymans
a20101c58c pulse-server: Add IPv4 address first in server list
So that zeroconf-discover prefers to publish with the IPv4 address
because that is likely more successfull.

See #2861
2022-12-01 20:17:08 +01:00
Wim Taymans
61e600970b loop: improve error handling from fds
When we try to read one of the events and there was an error, don't
signal the callback. If the error is something else than EAGAIN log
a warning.

Especially for timerfd, EAGAIN can happen when the timer changed
while polling. This can happen when running the profiler because it
polls and updates the timer from different threads.
2022-12-01 20:03:06 +01:00
Wim Taymans
cacfc74786 impl-node: improve handling of removed nodes
First we remove the node from the graph, then we disable all links
to it and then we Pause the node. It's possible that the node is still
scheduled while we remove the links. In this case we should not schedule
the node but resume the peer nodes. Also don't log a warning in this
case as it is expected.

Also don't log a warning when a node emits a ready event while it was
removed from the graph. This is also expected because we first remove
the node from the graph and then send the Pause/Suspend command to make
it stop emiting the ready events. Just ignore the event when this
happens.

See also !1449
2022-12-01 15:53:52 +01:00
Jonas Holmberg
968508cf4d impl-node: Don't schedule non-active node
Avoid scheduling non-active nodes by removing the eventfd source from
the data loop when the node is deactivated. Read any old value from the
eventfd when starting the node again in case it has been written to
while the source was removed from the loop.

The ready callback can still be called when the node isn't active since
it is not called via the eventfd.
2022-11-30 17:02:00 +01:00
Robert Mader
75007ae94f libcamera: Fix build error
This is backward compatible and will be needed for libcamera 0.0.3
2022-11-30 09:53:17 +00:00
Robert Mader
b952d52b59 libcamera: Handle missing control info default values
Libcamera does not always provide default values for all control infos, see
https://git.libcamera.org/libcamera/libcamera.git/tree/src/ipa/rkisp1/rkisp1.cpp?h=v0.0.2#n98

Sanitize those values, avoiding crashes.
2022-11-30 09:53:17 +00:00
Niklāvs Koļesņikovs
0da1a3ba82
meson_options.txt: Disable the legacy volume SPA
The volume plugin was an experiment that's not really used anywhere
that we're aware of. As such it makes sense to switch the default to
disabled state and skip building something no one probably needs.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2022-11-28 16:18:33 +02:00
Barnabás Pőcze
c933c5ed74 pipewire: module-zeroconf-publish: only unpublish service when necessary
When a server is stopped, only unpublish those services
that have been published with that particular server,
do not touch the others.
2022-11-28 14:54:04 +01:00
Wim Taymans
5f000b007d filter-chain: optimize copy plugin
A copy plugin at the input ports can be replaced by directly writing
into the peer input ports so that we can avoid a memcpy.
2022-11-27 11:56:00 +01:00
Wim Taymans
f673764e58 filter-chain: use optimized sum 2022-11-27 11:55:55 +01:00
Wim Taymans
ca8bc59d0a filter-chain: add biquad to dsp functions 2022-11-24 19:14:34 +01:00
columbarius
01b2552b71 spa: Add buffer meta information VideoTransform
This metadata can be used to signal that a buffer is transformed.
The values are intentionally choosen to coincide with
wl_output::transform from the wayland windowsystem.
2022-11-24 10:28:01 +00:00
Wim Taymans
f038e3f238 0.3.61 2022-11-24 09:57:59 +01:00
Wim Taymans
be1d4940a3 protocol-native: initialize fields
Set some of the fields to default values.

Fixes #2852
2022-11-24 09:40:14 +01:00
Bart Ribbers
c939a9edf7
spa/bluez: remove unused import fixing Musl builds with lc3
The include defines things like __uint16_t but these are unused here and glibc-specific anyway
2022-11-23 13:47:14 +01:00
Wim Taymans
0f79014e18 filter-chain: add some optimized mix functions 2022-11-22 17:59:44 +01:00
Wim Taymans
9d8edef1a0 client-node: guard against NULL resource
When destroying, the resource can be NULL (mix->io should also be
NULL ideally so we can check first).

See #2847
2022-11-21 20:20:16 +01:00
Barnabás Pőcze
67e77d13f6 client-node: set port data before calling _set_mix()
First set some of the port flags and data, especially the owner_data
before calling pw_impl_port_set_mix(), which will use the owner_data
to send the mix_info.

See #2847
2022-11-21 20:15:39 +01:00
Wim Taymans
8e9b136b10 jack: use node.passive to make passive links
Let the node.passive property make passive links. PIPEWIRE_LINK_PASSIVE
overrides the node property.

Add some nice tweaks for qsynth so that it suspends and fades out
nicely by default.
2022-11-21 16:02:30 +01:00
Wim Taymans
ead59e750f stream: get info from Position in Start
When we start, read the Position IO so that we collect the right quantum
etc before calling the process callback. This updates the requested
frames value in the buffer correctly with the current quantum instead of
using 0.

This fixes an issue in pw-cat with midi data. The first buffer has a
requested size of 0 and so the first events won't fit in it and are
discarded.

Fixes #2843
2022-11-21 15:22:33 +01:00
NorwayFun
b3ebba275a Update ka.po 2022-11-20 18:45:47 +00:00
Wim Taymans
0918899bf8 client-node: send the mix_info before Buffer IO
We don't always need to send buffers to a remote port, when the port
is an output port, all the mix ports use the same buffers. This means
that when we add another link to a port, we don't get the mix_info
anymore and then we don't know the peer_id and we don't complete the
link and we don't call the connection_callback.

Instead, send the mix_info right before sending the Buffer Io area. We
always do this for all mix io and after we have sent the buffers so this
is a better place.

Fixes #2841
2022-11-20 19:24:01 +01:00
Wim Taymans
a0adb52124 pulse-server: add a pulse.idle.timeout option
When a client is not sending any data when it should be and causes an
underrun, mark it as idle and record the timestamp.

When a client is idle for pulse.idle.timeout seconds, set the stream
as inactive. When more data is received, set it back to active.

Add a pulse.idle.timeout option to set a global server default or
a per-stream value. Set the server default to 5 seconds. A value of 0
can be used to disable this feature.

With this change, badly behaving clients that are not sending any data
will be paused so that the sinks can suspend to save battery power.

Fixes #2839
2022-11-20 16:20:05 +01:00
Wim Taymans
b1c0662a00 pipewire-pulse: improve parsing of defaults
When we fail to parse a fraction from the config, give a warning and
continue with the default settings.
Print the final parsed value as debug.
2022-11-20 16:19:24 +01:00
Wim Taymans
fc159be9c6 pulse-server: make method to pause/resume stream
Make a method to pause and resume a stream and keep track of the paused
state of the stream. Use this function instead of setting the stream
inactive/active so that we get nice logging for each state change.
2022-11-20 16:19:24 +01:00
Wim Taymans
4c3f56fca1 resample: cleanup the resampler core functions
Move the increment function to a macro.
Don't use extra local variables, we can just as well call the resample
functipon with them.
2022-11-20 16:19:24 +01:00
Wim Taymans
bb558b7d95 audioconvert: don't overwrite port
Make a new variable to iterate the other ports so that we can use the
original port to emit notifications.

Fixes Latency and other params set on DSP ports.
2022-11-18 13:21:14 +01:00
Wim Taymans
43d02410e6 audioconvert: don't handle params when just enumerating
When we are simply enumerating the params, just collect the info
but don't act on them, like clearing the format or recalculating
the latency.

This avoids some useless work when enumerating params.

Use the more complete configure_format function to clear the format
and buffers when the EnumFormat param changed.
2022-11-18 09:34:37 +01:00
Wim Taymans
82f7ed419c audioconvert: shortcut configure_format
When we don't have a format and can't to clear it, we can return
immediately.
2022-11-18 09:29:23 +01:00
Wim Taymans
bc66060b7d audioconvert: also clear buffer when new EnumFormat
Fixes #2832
2022-11-17 19:41:12 +01:00