Commit graph

5341 commits

Author SHA1 Message Date
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
Thomas Weißschuh
d4db7e1d9b pw-dump: sort dictionaries
Dictionaries are by default printed in their insertion order.
This is unergonimic when comparing properties created by different
clients, as they may insert them in different orders.
2023-01-06 11:15:17 +00:00
Wim Taymans
6116ef8484 impl-port: clear peer buffers in suspend
When we clear the buffers on an output port when we clear the port
format in suspend, also clear the buffers shared by the peer input
port mixers because else they would reference old stale buffers.

Fixes #2914
2023-01-02 17:24:35 +01:00
Wim Taymans
6b228944f7 impl-port: clear have_buffers when setting 0 buffers 2023-01-02 16:03:36 +01:00
Wim Taymans
860b8fc27f modules: fix rate update
Setting the rate with the PROP_rate would actually result in a rate
adjustment of 1.0f / rate, so do the same here.

See #2891
2022-12-29 12:22:56 +01:00
Barnabás Pőcze
73c5f6e1bf pipewire: module-roc-{sink,source}: port to ROC v0.2.X
Incompatible changes between ROC v0.1.X and v0.2.X require
adjusting the ROC modules' code. The largest change is going
from `roc_address` to `roc_endpoint`. There is also a breaking
change, the removal of `local.ip` parameter from module-roc-sink
as `roc_sender_bind()` has been removed.

The API usage was modelled after https://github.com/roc-streaming/roc-pulse

See #1757
Fixes #2911
2022-12-29 10:13:30 +00:00
Robert Mader
be99aa1eba gst: deviceprodiver: Add fd property / camera portal support
Add a `fd` property to `GstPipeWireDeviceProvider` so it can be used
with fds obtained from e.g. the camera xdg-desktop-portal.

This is needed so apps like Cheese or Camera can easily implement the
camera portal.
2022-12-27 23:43:22 +01:00
Robert Mader
2bc3e0ca10 gst: deviceprodiver: Use GstPipeWireCore and some cleanups
Quoting the commit introducing `GstPipeWireCore`:
```
Make all sources in the same process with the same fd share the
connection to the server. This makes it possible to set the same
fd on multiple sources/sinks and have them all use the same
connection, like when capturing multiple monitors from screencast
with the portal.
```

Do the same for `GstPipeWireDeviceProvider`, so it can share a
connection with device sinks as well. This will be needed for fd based
connections introduced in the next commit.

Further more it allows some cleanups.

1: 70652d1a37
2022-12-27 23:36:36 +01:00
columbarius
9f1311a2e0 examples: only use memfd_create when defined
See #987
2022-12-20 10:42:28 +01:00
Julian Picht
8c0a94c9d8 module/roc-*: fix position of comment 2022-12-19 12:47:47 +01:00
Julian Picht
b47e799c9a module/roc-*: implement audio.rate 2022-12-19 12:25:33 +01:00
Wim Taymans
846dbce7f1 doc: update after PIPEWIRE_DEBUG changes 2022-12-16 18:29:19 +01:00
Wim Taymans
f4f316b951 filter-chain: move fft to dsp_ops 2022-12-16 11:30:18 +01:00
Wim Taymans
b6b6efff42 convolver: use normal float for complex float array 2022-12-16 10:51:19 +01:00
Wim Taymans
538b6ce35e filter-chain: use dsp sum/copy/clear functions 2022-12-16 10:22:01 +01:00
Wim Taymans
0f2f113bdc filter-chain: add optimized sum function 2022-12-16 10:19:20 +01:00
Wim Taymans
cd38d7b53b filter-chain: move functions to separate struct
So that it's easier to copy them.
2022-12-16 09:37:45 +01:00
Wim Taymans
fa10849139 filter-chain: pass dsp_ops around
Initialize dsp_ops in the filter-chain and pass it around.
2022-12-16 09:28:00 +01:00
Wim Taymans
f7c49bbdde pulse-server: add channel-map in echo-cancel module 2022-12-15 13:12:47 +01:00
Wim Taymans
5f30ccae50 pipewire: remove redundant code
The generic code can now also handle the single character debug
specification.
2022-12-14 18:54:50 +01:00
Wim Taymans
9b3b6e2401 pipewire: support global log level in PIPEWIRE_DEBUG
Add support for PIPEWIRE_DEBUG=3,foo.bar:5 to set a global log level in
addition to specific topics.

Previously it would have to be done with *:3,foo.bar:5, which would not
really set a global level but all topics to the custom level of 3.
2022-12-14 18:00:54 +01:00
Wim Taymans
72bee99f87 pulse-server: add category for connection debug
Use a new conn. topic to debug the messages. These are disabled by
default.
2022-12-14 16:40:58 +01:00
Wim Taymans
34973eac89 pipewire: fix pw_debug_is_category_enabled()
The function was broken since the log topics were added.

Use the logger to init a topic with the given name and check if
there was a custom level for the topic.
2022-12-14 16:20:23 +01:00
Dylan Aïssi
cbc75dc98d pw-mon: recognize -N and -C as valid options 2022-12-14 11:07:42 +01:00
Wim Taymans
144df8675f audioconvert: enable channelmix.mix-lfe by default
It seems OK and SDL also seems to mix LFE by default so what could
possibly go wrong.

Fixes #2425
2022-12-13 16:29:46 +01:00
Wim Taymans
61750813ff filter-chain: move buffer resample to separate function
Fix the error paths.
Rename some variables around to make things clearer.
2022-12-13 12:18:46 +01:00
Dmitry Sharshakov
28af79be79 filter-chain: convolver: flush, add resampler quality option
Robustness fix: don't truncate IR, free the resampler state after use.
2022-12-13 10:09:55 +00:00
Dmitry Sharshakov
7950d3ff0d filter-chain: convolver: resample IR
Ensure correct filtering when node rate does not match filter rate
2022-12-13 10:09:55 +00:00
Wim Taymans
b5c21c1fbc pipewire: use dlclose unless PIPEWIRE_DLCLOSE is set to false
Always dlclose the libraries but use PIPEWIRE_DLCLOSE to override this
behaviour.

Fixes #2786
2022-12-12 17:11:04 +01:00
Wim Taymans
b29200ee82 pulse-server: add a pulse.cmd section
Add a new config section that can contain a set of commands to run after
starting.

There is only load-module available now but it can be used to remove the
dependency on pactl when starting the server.
2022-12-12 16:46:16 +01:00
Wim Taymans
87d2719148 utils: expose pw_split_ip 2022-12-12 16:45:30 +01:00
Barnabás Pőcze
3bdd2e01c5 pipewire: store SPA handles in a global list by age
Operating on the assumption that every SPA handle
can reference any other older SPA handle, the only
safe destruction order is from youngest to oldest.

To achieve this, store all handles across all plugins
sorted by age (youngest first), and use that as the
order of destruction in `pw_deinit()`.

This line of thinking does not account for what happens
when a handle that is referenced by others is unloaded,
but it does not make that case worse either.

See #2881
2022-12-10 00:46:37 +01:00
Wim Taymans
45235172c8 pulse-server: disable idle.timeout by default
Only enable pulse.idle.timeout for selected applications
(speech-dispatcher) and let other applications be. We can also
lower the minreq and min-quantum of speech-dispatcher now.

Fixes #2880
2022-12-09 10:00:32 +01:00
Wim Taymans
a6f8790ece pw-top: log core errors, silence other errors with info 2022-12-08 17:29:19 +01:00
Wim Taymans
ced0f853a1 impl-node: improve state change when driver changes
Imagine this case with pw-loopback:
 - the output stream is created and connected
 - the input stream is created and connected
 - the output stream is linked first and input+output move to the
   sink as the driver. Start is sent to input+output but delayed
   for the driver until all is complete.
 - the input stream is linked to a source. The source becomes the
   new driver and input+output+sink is moved to the source.
 - all completes, the source is sent the Start command because it is
   a driver. The sink also completes but is not sent a Start Command
   because it is no longer a driver.
   -> sink is scheduled but not started and gives errors

This patch clears the pending state of a driver when it is no longer
a driver. This makes the new driver set a new state (and cancel the
old state) and all followers will start correctly.
2022-12-08 16:24:52 +01:00
Wim Taymans
638de5a3b7 gst: set stride to 0
We don't really know any better yet.
2022-12-08 13:39:58 +01:00
Wim Taymans
8db85cf198 examples: handle 0 stride better
Assume the stride is size/height in case someone doesn't set the stride
correctly.
2022-12-08 13:39:58 +01:00
Jonas Holmberg
83f1de95c0 module-loopback: connect playback before capture
Connect the playback stream before the capture stream since the capture
stream can otherwise trigger playback_process() before the playback node
has been activated.
2022-12-08 13:31:45 +01:00
Wim Taymans
dee2a51eb0 impl-node: don't pass the -EBUSY to the caller
Let the caller receive EBUSY from the _set_state method instead of
an error code to make sure it doesn't go into error.
2022-12-08 12:38:36 +01:00
Wim Taymans
9bf6fa05d1 module-rtp-sink: silence some messages 2022-12-08 12:10:22 +01:00
Wim Taymans
2f397035b8 modules: don't call pw_stream_set_control in process
pw_stream_set_control can only be used from the pipewire main_loop, not
the process callback. Instead, use the rate_match field directly.

Fixes #2633
2022-12-08 11:01:24 +01:00