Commit graph

8880 commits

Author SHA1 Message Date
Wim Taymans
24fc972164 vulkan: add some more error checks 2022-06-06 12:13:20 +02:00
Wim Taymans
6e681fc98d vulkan: more improvements 2022-06-06 12:13:19 +02:00
Wim Taymans
e6f01563ab vulkan: support multiple streams of buffers 2022-06-06 12:13:19 +02:00
Wim Taymans
332e8b7029 vulkan: start of vulkan filters 2022-06-06 12:13:19 +02:00
Pauli Virtanen
8898a6a8f0 bluez5: don't consider profiles the adapter doesn't have
Don't try to reconnect or wait for profiles, which cannot be connected
because the adapter doesn't have the counterpart sink/source profile.

E.g. we should not reconnect/wait for HFP HF on remote device, if
we don't have the corresponding HFP AG.
2022-06-05 18:15:42 +00:00
Pauli Virtanen
8383ee8552 bluez5: a2dp-sink: address A2DP transport acquire failure mode
If A2DP remote does not acquire its pending transport within a timeout,
we won't get a write error in a2dp-sink, but instead the transport
becomes idle.  Currently, we continue writing to the socket as if
everything was fine, even though the data won't be processed at the
remote end.

Handle this by stopping the node and emitting a node error event.
Pipewire may then restart the node to retry.
2022-06-05 18:10:01 +00:00
Pauli Virtanen
fc4f831afa audioconvert: forward follower node errors
If the follower of the adapter emits an error event, the adapter needs
to forward it to upper levels so that they know the node has errored,
and handle the situation.
2022-06-05 18:10:01 +00:00
Barnabás Pőcze
c248091528 pulse-server: module-switch-on-connect: remove dead code and one allocation
As Coverity correctly points out, the `if (blocklist)` condition
is never true after the `out` label, so this commit makes some
changes to remove the dead code.

First of all, the `regex_t` object is directly embedded in the
module's data struct, so the `malloc()` call can be removed,
and thus there is no need for the cleanup code anymore, so everything
after the `out` label is also removed.

Furthermore, two NULL checks are removed which check `d->blocklist`
from `module_switch_on_connect_unload()` and `manager_added()`
because both of those functions can only ever run if the `d->blocklist`
regex object has been successfully initialized in `module_switch_on_connect_prepare()`.
Those checks were not strictly needed to begin with.
2022-06-05 18:04:03 +00:00
Pauli Virtanen
8949d45c69 bluez5: check decode/encode capability also at registering
Endpoints without decode/encode capability are skipped in the object
manager, but we should also skip them in the registration calls (even
though in practice this doesn't appear to matter).
2022-06-05 18:03:24 +00:00
Wim Taymans
a84412ccb7 modules: improve parsing of rate and channels 2022-06-04 18:54:50 +02:00
Barnabás Pőcze
f2c53622d2 pipewire-jack: use jack_client_close() to free client in error path
The client needs to be cleaned up properly, otherwise references
to its storage may remain, which can later result in use-after-frees.
For example, the via the various embedded `spa_hook`s in it.

See #2394
2022-06-04 12:42:44 +02:00
Barnabás Pőcze
c6a5698eac pipewire-jack: check before destroying
Check pointers before calling the destructors (where needed), so that
a not fully constructed `client` object may be passed to `jack_client_close()`.

Furthermore, remove the metadata proxy and object listeners as well.
2022-06-04 12:42:17 +02:00
Barnabás Pőcze
15d5ab2425 pipewire-jack: move client-node setup right after creation
Move the client-node setup code right after the client-node
creation, so that they are close to each other.
2022-06-04 12:42:17 +02:00
Barnabás Pőcze
d7a7d7f738 pipewire-jack: initialize certain members right after allocation
Move the initialization of some of `client`'s members right after
allocation, so that it will be simpler to tear down the client object
even if `jack_client_open()` fails later.

Furthermore, initialize `client::driver_id` to `SPA_ID_INVALID`.
2022-06-04 12:42:17 +02:00
Wim Taymans
0f839c7b61 modules: clamp input offset and size
So that we don't cause memory errors with invalid input.
2022-06-04 11:47:48 +02:00
Wim Taymans
24ba3f4d92 module-roc: improve sender loop
FIxes #2422
2022-06-04 10:57:20 +02:00
Barnabás Pőcze
876a5977f3 pulse-server: module-pipe-{sink,source}: drop redundant log messages
It is already logged by the module loading code when a module is
successfully loaded, so there is no need to print it on a per-module
basis at the same log level.
2022-06-03 17:24:27 +02:00
Wim Taymans
efe30d5075 pulse-server: send STREAM_MOVED messages
Keep track of the last known peer of a stream and send a moved message
when it changes.

Fixes #2407
2022-06-03 16:59:08 +02:00
Wim Taymans
be9c738661 pulse-server: keep stream latency around 2022-06-03 16:58:37 +02:00
Wim Taymans
ebe673aecb doc: update with pipe-tunnel 2022-06-03 16:23:34 +02:00
Wim Taymans
1252927d73 pulse-server: check all pending streams
Check all pending streams to see if the new link completes their
creation.

It is possible that the link linked 2 pending streams and then we
want to complete them both.
2022-06-03 15:50:54 +02:00
Wim Taymans
258a203d74 pulse-server: optimize link finding
When we get a new link object, only check if a pending stream is linked
according to the new link instead of iterating all links.
2022-06-03 15:48:08 +02:00
Wim Taymans
6c310cf5e2 gst: add client-properties
To update the client properties of the connection.

Fixes #1573
2022-06-03 13:00:52 +02:00
Wim Taymans
6276253c30 pulse-server: implement pipe sink/source with module 2022-06-03 11:51:29 +02:00
Wim Taymans
87172fde06 modules: align tunnel.mode
Source for a source, sink for a sink. We use capture and playback for
streams that link to a source/sink respectively.
2022-06-03 10:52:45 +02:00
Wim Taymans
fe1652e843 modules: add more docs and options to pipe-tunnel 2022-06-03 10:52:45 +02:00
Wim Taymans
af41d45e1a modules: add pipe tunnel 2022-06-03 10:52:45 +02:00
Barnabás Pőcze
f1b0cfd546 pulse-server: mark module_*_prepare() methods static
Since 37fa911a72 ("pulse-server: module: rework registry") none
of the module methods need to have external linkage.
2022-06-02 23:56:55 +02:00
Barnabás Pőcze
75d28cadcd pulse-server: rename module_info::prepare() to create()
Now that the method does not actually create the `module` object,
it would be somewhat misleading to call it "create",
so rename it to "prepare".
2022-06-02 23:56:55 +02:00
Barnabás Pőcze
fa3a28ab68 pulse-server: pass already created module object to module_info::create()
All modules need to manually create a `module` object and check
if it was successfully created. The same with argument parsing.
To simplify modules, move the module object creation and argument
parsing into `module_create()`, and pass the already initialized
module to `module_info::create()`.

The semantics of `module_info::create()` are kept, that is,
if it fails, `module_info::unload()` will not be called.
2022-06-02 23:56:55 +02:00
Barnabás Pőcze
5ad52bb88a pulse-server: do not put static properties into module::props
Now that the module's properties are served from `module_info::properties`,
there is no need for modules to put their static properties into
the `module::props` dictionary.
2022-06-02 23:56:50 +02:00
Barnabás Pőcze
c9f632da9f pulse-server: serve module properties from static list
None of the modules really need a dynamic property list,
so serve the properties from a static list.
2022-06-02 15:17:45 +02:00
Wim Taymans
774ade1467 stream: improve docs about direction 2022-06-02 13:06:03 +02:00
Wim Taymans
6e6385e27d acp: don't mix non-AUX and AUX channels
When filling up the channels, either fill up the positions with one
of the know layouts or use AUX channels, never try to mix them.

This avoid cards with a large number channels to show a strange mix
of surround and AUX channels.
2022-06-02 12:54:04 +02:00
Wim Taymans
30d9b743a2 acp: return map on success
We need to return the channelmap when we have successfully filled
it.
2022-06-02 12:44:31 +02:00
Wim Taymans
2c4d36e4d0 pulse-server: always send frame_size multiples of samples.
See #2421
2022-06-02 09:05:23 +02:00
James Hilliard
64e8dee3a7 gst: dup buffer file descriptor before allocating
Since gst_fd_allocator_alloc lazy mmap's the buffer to the assigned
file descriptor we can get downstream mmap failures if the pipewire
src(such as the v4l2 spa plugin) closes the file descriptor before
it gets mmap'd. To prevent the closed original file descriptor from
causing a mmap failure dup the file descriptor so that the original
being closed doesn't invalidate the descriptor passed to
gst_fd_allocator_alloc.

Add some more validation to dequeue_buffer as well.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-06-02 06:44:10 +00:00
Barnabás Pőcze
479896279e spa: support: loop: handle cancellation better
Register a pthread cleanup handler to guarantee
that `spa_source::{priv, rmask}` are cleared even
if the thread is cancelled while the loop is dispatching.

This is necessary, otherwise `spa_source::priv` could point
to the stack of the cancelled thread, which will lead to
problems like this later:

  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  0x00007f846b025be2 in detach_source (source=0x7f845f435f60) at ../spa/plugins/support/loop.c:144
  144      e->data = NULL;
  [Current thread is 1 (LWP 5274)]
  (gdb) p e
  $1 = (struct spa_poll_event *) 0x7f845e297820
  (gdb) bt
  #0  0x00007f846b025be2 in detach_source (source=0x7f845f435f60) at ../spa/plugins/support/loop.c:144
  #1  0x00007f846b0276ad in free_source (s=0x7f845f435f60) at ../spa/plugins/support/loop.c:359
  #2  0x00007f846b02a453 in loop_destroy_source (object=0x7f845f3af478, source=0x7f845f435f60) at ../spa/plugins/support/loop.c:786
  #3  0x00007f846b02a886 in impl_clear (handle=0x7f845f3af478) at ../spa/plugins/support/loop.c:859
  #4  0x00007f846b172f40 in unref_handle (handle=0x7f845f3af450) at ../src/pipewire/pipewire.c:211
  #5  0x00007f846b173579 in pw_unload_spa_handle (handle=0x7f845f3af478) at ../src/pipewire/pipewire.c:346
  #6  0x00007f846b15a761 in pw_loop_destroy (loop=0x7f845f434e30) at ../src/pipewire/loop.c:159
  #7  0x00007f846b135d8e in pw_data_loop_destroy (loop=0x7f845f434cb0) at ../src/pipewire/data-loop.c:166
  #8  0x00007f846b12c31c in pw_context_destroy (context=0x7f845f41c690) at ../src/pipewire/context.c:485
  #9  0x00007f846b3ddf9e in jack_client_close (client=0x7f845f3c1030) at ../pipewire-jack/src/pipewire-jack.c:3481
  ...
2022-06-02 00:24:24 +02:00
Wim Taymans
0d51f3b74e pulse-server: always send at least fragsize data
Make sure to never send less than the negotiated fragsize to a client.
Also make sure we don't send too much data in one go. This is more in
line with what pulseaudio does.

Fixes capture from multiple tabs in chrome.

Fixes #2418
2022-06-01 15:43:07 +02:00
Wim Taymans
1245309a7b alsa: sync acp with pulseaudio 2022-06-01 13:11:00 +02:00
James Hilliard
a1f33a99df gst: dequeue a shared buffer instead of original pool buffer
This seems to prevent the pool buffer from getting corrupted.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-06-01 04:09:59 -06:00
James Hilliard
7305d38b85 gstpipewiresrc: don't mix tabs and spaces
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-05-31 02:46:27 -06:00
Wim Taymans
752643c295 spa: debug memcpy 2022-05-31 10:31:26 +02:00
George Kiagiadakis
b8bb7ce9da impl-port: set port.alias if not already set
This makes the video nodes have meaningful aliases on their ports,
which make them look nicer in user-facing tools like wpctl and qpwgraph.
2022-05-31 11:17:56 +03:00
James Hilliard
7cc509b117 buffers: ensure buffer size does not exceed maxsize
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-05-31 07:25:31 +00:00
George Kiagiadakis
bf0ff347c1 pipewiresink: trigger process() manually when in driver mode
When in driver mode (mode=provide), the process() function is never
called. It needs to be triggered manually every now and then.

This fixes starting a mode=provide sink, but it doesn't fix re-starting
it... if the client disconnects while streaming, all buffers are getting
filled up and the pool blocks in aqcuiring one more; when the client
connects again, even if we signal the cond to unblock the pool, it still
can't acquire any more buffers and deadlocks.

Relates to: #1980
2022-05-31 07:24:41 +00:00
Wim Taymans
b6aeb1310c impl-port: pass the right param 2022-05-30 10:54:32 +02:00
Wim Taymans
a58d815024 bluez5: implement freewheel in sink
We need to skip all samples.
2022-05-30 09:54:22 +02:00
Wim Taymans
0cdcd04f77 bluez5: use position clock time
Use the position clock time and fall back to the monotonic time.
2022-05-30 09:53:37 +02:00
Pauli Virtanen
ebccd89ae1 bluez5: a2dp-sink: update follower current time
Update follower current time in process, since it is otherwise not
updated. Fixes bitpool control as follower.
2022-05-30 07:40:52 +00:00