Commit graph

5131 commits

Author SHA1 Message Date
Wim Taymans
ee55df9f9e alsa: add option to change the volume-method
Add option to set linear or cubic volume, cubic is now the default.
2023-01-20 10:11:49 +01:00
Martin Geier
98163d90df client-node: iterate the buffer datas correctly
Don't just read the first buffer data in the loop but use the loop index to
get the right one.
2023-01-19 17:22:29 +01:00
Wim Taymans
d11fb766c6 module-pipe: improve properties on nodes
Actually move the stream properties in stream.props object for the pipe
tunnel module.
Set pipe.filename on the node. Remap this to device.string in pulse.
Add some more default properties on the pipe nodes.

See #2973
2023-01-19 11:05:54 +01:00
Wim Taymans
cb8d9f38b2 stream: handle the case where io is NULL
Some older servers set the io area after starting the node and so the
node runs first without io areas, just return an error instead of
crashing.

Fixes #2964
2023-01-19 10:19:14 +01:00
Wim Taymans
1126fbd26c filter-chain: simplify a little
We can reuse the array of filenames for the single filename case
and remove some duplicate code.
Handle some errors better.
2023-01-18 18:22:34 +01:00
Wim Taymans
30057967dd module-filter-chain: fix array size 2023-01-18 18:06:19 +01:00
Wim Taymans
9d66de446b convolver: parse array from filename 2023-01-18 16:59:25 +00:00
Barnabás Pőcze
051d223d73 filter-chain: review suggestions 2023-01-18 16:59:25 +00:00
Dmitry Sharshakov
2251b9b1d9 filter-chain: allow multiple filters for convolver
Choose the closest match to reduce resampling loss. If match is not equal, resample.

Keep the backwards compatibility retaining `filename` property. When both set, `filenames` takes priority
2023-01-18 16:59:25 +00:00
Wim Taymans
6207d98ff1 spa: add debug log context
Make a real debug context with a log function and move it to a new file.
This way we don't need to redefine a macro.
Make a new context for debugging to a log file. Make new functions to
debug to a log file.
Move the stringbuffer to string utils.
Integrate file/line/func and topics into the debug log.
We can remove some more things from the pipewire log_object function and
also add support for topics.
2023-01-18 17:51:16 +01:00
Wim Taymans
3c67821c4a spa: add context to debug functions
Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.

Use this to let some plugins log the pod and format to the log without
using the global logger.

Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.
2023-01-18 13:12:16 +01:00
Wim Taymans
f472fd736d fix includes
Only include debug we need. We usually only need the debug types.
2023-01-18 13:12:16 +01:00
Wim Taymans
37a5dca31e module-echo-cancel: update docs with monitor.mode property 2023-01-17 13:18:13 +01:00
Wim Taymans
edd3113c43 pulse-server: add remaining formats
The ones that have no pulseaudio equivalent will be filtered out when we
parse or create messages.

See !1499
2023-01-17 12:26:06 +01:00
Wim Taymans
a979c0f430 keys: don't remove deprecated symbols by default
Add a new macro to mark deprecated keys. The macro will emit a warning
about the symbol being deprecated.
PW_ENABLE_DEPRECATED will suppress the deprecation warning.
Add PW_REMOVE_DEPRECATED to completely remove the deprecated symbols.

Fixes #2952
2023-01-17 11:58:04 +01:00
Wim Taymans
ccedf1722a filter-chain: fix AVX dsp_sum index increment
Fixes #2965
2023-01-17 09:24:00 +01:00
Wim Taymans
68d9c33078 module-echo-cancel: allow per stream AUDIO_POSITION settings
Keep per stream audio info. We copy the global rate and format to
everything but allow for the channel positions to be overwritten
per stream. Invalid channel positions will revert to the default
again.

With a taget.object, this makes it possible to link the echo cancel
stream to specific pro audio sink ports.

Fixes #2939
2023-01-16 15:11:02 +01:00
Wim Taymans
e86acd8930 module-rt: improve rt settings
Refactor get_rt_priority_range().
When we can't set the requested priority, use rlimit to clamp it
and try again. If this clamped value is bigger than RT_PRIO_MIN,
we can allow this.

The result is that the RTPRIO is set to the max of the user rlimit
RTPRIO, as long as it's more than 11. Previously it would fall back
to RTKit.
2023-01-16 13:08:37 +01:00
Wim Taymans
28aa9ebe64 pulse-server: add more valid formats
Add some more formats that can be used in pipewire streams so that
pulseaudio will see them as valid devices/streams.

It is possible that this will result in an invalid format on the client
when there is no pulseaudio format defined, but that is ok.

See !1499
2023-01-16 11:05:06 +01:00
Thomas Weißschuh
6f84bef2b0 pulse-server: split device info validation into dedicated function 2023-01-16 11:05:06 +01:00
Szabolcs Szőke
bb1f595b53 adapter: support custom prefix for device ports
Prefixes can be disabled for device ports by providing an empty string
2023-01-16 08:25:41 +00:00
Dmitry Sharshakov
7b355d5628 convolver: add gain when resampling to preserve volume 2023-01-15 11:53:30 +00:00
Dmitry Sharshakov
e0cc072100 filter-chain: use equal rate for capture and playback
If only one of rates is provided, propagate it. If both are provided and are inequal, warn.

This configuration appears to be broken for obvious reasons
2023-01-14 19:52:47 +00:00
Wim Taymans
792defde27 adapter: only add port name override when not empty
This makes it possible to add an empty string to keep the original
port name.
2023-01-13 17:52:24 +01:00
Robert Mader
6bf47e0bfa pipewiresrc: Always advertise support for DmaBuf
Quoting https://docs.pipewire.org/page_dma_buf.html section "v4l2":
```
It's the the responsibility of the producer while the add_buffer event
to choose DMA-BUF as the used buffer type even though no modifier is
present, if it can guarantee, that the used buffer is mmapable.
```

As Gstreamer internally can mmap dmabufs just fine, support this case.
This enables dmabuf support with V4L2 and libcamera.

This was also tested against Gnome-Shell, which correctly handles this
case and only chooses DmaBuf if the negotiated format has a modifier,
i.e. if the Gstreamer peer supports the format with
`GST_CAPS_FEATURE_MEMORY_DMABUF`.

Fixes 602aa7d541
2023-01-12 11:27:27 +00:00
Robert Mader
17c53577e8 gst: Log buffer memory type
This is helpful when one wants to ensure the right memory type is used,
independently from the negotiated format.
2023-01-12 11:27:27 +00:00
Wim Taymans
cab3e3c1ce clarify deprecated use of NODE_TARGET 2023-01-10 17:21:02 +01:00
Wim Taymans
c3032c70b6 keys: move NODE_TARGET to deprecated properties
Add PW_ENABLE_DEPRECATED to some places where we can not yet
avoid removing support.
2023-01-10 17:17:34 +01:00
Wim Taymans
95f87301c7 clarify PIPEWIRE_NODE
PIPEWIRE_NODE is mapped to TARGET_OBJECT so it contains the serial or
the node name.
Make sure pw-stream maps this to TARGET_OBJECT.
Make JACK use the PIPEWIRE_NODE for serial or node.name.
2023-01-10 17:11:43 +01:00
Wim Taymans
2254c74fb9 use TARGET_OBJECT instead of the deprecated NODE_TARGET
Clarify the docs.
2023-01-10 16:51:47 +01:00
Wim Taymans
a7df07c449 gst: don't set the deprecated path anymore
Just use the target_object property instead which uses the object.serial
is is less prone to races when the object id is recycled.
2023-01-10 16:47:47 +01:00
Wim Taymans
1beddd78d2 tools: clarify the target param
The target param is an object.serial or node.name.
Use TARGET_OBJECT instead of NODE_TARGET.
2023-01-10 16:45:50 +01:00
Wim Taymans
8767e8ed97 pulse-server: handle .monitor master source 2023-01-10 16:22:39 +01:00
Wim Taymans
ff69454eb4 pulse-server: use TARGET_OBJECT
The pulse API uses either the node.name or object.serials so pass this
along in the TARGET_OBJECT instead of the NODE_TARGET now that
wireplumber handles this.
2023-01-10 16:05:55 +01:00
Wim Taymans
624e265fd6 pulse-server: clear the drained state correctly
When we start the drain, we unpause the stream. When we conplete the
drain, we unpause again, which does nothing when the stream was already
unpaused. However, this leaves the drained state on the stream and so
the stream will never be able to play new data.

Trigger a new pw_stream_set_active() with the current stream state to
clear the drained state.

Fixes #2928
2023-01-10 12:49:22 +01:00
Wim Taymans
97aafe2234 fix use_buffers checks
We can set 0 buffers even if there is no format.
Return -ENOSPC when too many buffers are set.
2023-01-10 12:30:25 +01:00
Wim Taymans
9f3237b74e context: keep per node quantum and rate settings
Copy the global quantum and rate limits before applying node specific
settings. Otherwise one node settings will propagate to the defaults
of the next nodes, which can result in impossible or wrong settings.

See #2925
2023-01-09 17:56:04 +01:00
Wim Taymans
ba374a7b47 impl-node: restore running state after reconfigure
Add a reconfigure state on the node that is set when the node was IDLE
or RUNNING when reconfigured.

The node state will be set to the running state as long as the
reconfigure state is active. When the node is running, the reconfigure
state is unset again and the node is allowed to IDLE as usual.

This fixes the case where an IDLE (but not paused node) will be
suspended when a rate change happens but will then not resume
afterwards.

This causes problems with rate changes and nodes that have the suspend
disabled by the session manager. They will be suspened anyway and this
can cause problems for devices that need to keep running to keep the
amplifiers active.

Fixes #2929
2023-01-09 11:49:10 +01:00
Wim Taymans
07633f2146 context: rename a method
Rename suspend_driver -> reconfigure_driver because that is more like
what it does.
2023-01-09 11:49:10 +01:00
Wim Taymans
e099f0598a pw-reserver: improve output a little 2023-01-09 11:49:10 +01:00
Wim Taymans
26496724c6 impl-node: move 2 state variables to private
So that they can be used when making scheduler decisions.
2023-01-09 11:49:10 +01:00
Wim Taymans
0ddf80d470 midifile: error won invalid track size
When the track data would exceed the file size, return an error.
2023-01-09 11:49:10 +01:00
Wim Taymans
6a516b9505 context: fix typo in comment 2023-01-09 11:49:10 +01:00
Robert Mader
602aa7d541 pipewiresrc: Reenable DMABuf support
This was disabled in 15b4c58e as under various circumstances Gstreamer
pipelines would mmap the DMABufs, which can be very slow in various cases.
One typical example of that is screen casting using a dedicated graphics card.

Thus we only want to use DMABufs if the peer element advertises support for
`GST_CAPS_FEATURE_MEMORY_DMABUF`, ensuring no mapping will happen if we
set the format accordingly.

This allows pipewiresrc to be used with DMABufs for fully accelerated
pipelines or in combination with a download element such as `gldownload`[1]
without regressing the commit above. The `gldownload` approach mirrors
what webrtc (Chromium/Firefox) does, but without duplicating the
functionality into pipewiresrc.

While on it, also implement dmabuf negotiation according to
https://docs.pipewire.org/page_dma_buf.html with the modifiers
`DRM_FORMAT_MOD_INVALID` and `DRM_FORMAT_MOD_LINEAR` in order to allow
dmabuf negotiation with more modern clients, including Gnome-Shell.

1: for now use something like `glupload ! glcolorconvert ! gldownload` -
   `gldownload` does not support importing DMABufs yet but `glupload` does.
2023-01-08 09:17:19 +00:00
Jan Beich
6d58c73937 module-rt: fix warning when xdg-desktop-portal isn't running
$ pipewire
...
[W][1234.001] mod.rt       | [     module-rt.c:  278 pw_rtkit_check_xdg_portal()] Can't find xdg-portal: (null)
...
2023-01-08 07:29:42 +00:00
Wim Taymans
b2f43e7bad pulse-server: fix echo-cancel _master args
The sink_master and source_master should be set on the capture and
playback streams so use the new properties on module-echo-cancel to do
this.
2023-01-07 15:00:40 +01:00
Wim Taymans
feac9f1c70 module-echo-cancel: add capture and playback props
Add a capture.props and playback.props config section to set properties
for the capture and playback stream.

Fixes #2939
2023-01-07 13:58:30 +01:00
Dmitry Sharshakov
6fb543a514 adapter: support node.channel-names
Allow customizing channel names for nodes
2023-01-06 23:17:33 +03:00
Wim Taymans
4f458b5d9a filter-chain: dynamically allocate the params
Dynamically allocate the offsets and params arrays so that it can
support more than 512 params.

Fixes #2933
2023-01-06 12:41:06 +01:00
Robert Mader
be2757c121 gstpipewireformat: Fully handle SPA_CHOICE_Step
The step value was not used.
2023-01-06 11:16:52 +00:00