Commit graph

8846 commits

Author SHA1 Message Date
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
Pauli Virtanen
ca18b8b733 bluez5: endpoint can be used only by one device at a time
AVDTP (v1.3 Sec 5.3) has a limitation that a local SEP (on the same
adapter) can be connected to at most one remote SEP. Trying to do have
it connected to multiple remotes either fails or causes misbehavior
later on.

Skip SetConfigure the same local endpoint for multiple remote ones in
codec switch. BlueZ observes this restriction in SelectConfiguration,
so also it won't try to do invalid configurations.

In BlueZ 5.64, the SetConfiguration calls succeed, but subsequent
transport acquires will fail. (Likely already the SetConfiguration DBus
call should fail.)

This all has the consequence, with the current approach to the
codec=endpoint correspondence, that if multiple devices are connected to
the same adapter, they currently have to use different codecs.
2022-05-30 07:35:54 +00:00
Fabrice Fontaine
85ca67b927 fix detection of reallocarray
Fix detection of reallocarray (e.g. on glibc) raised since commit
0708a39b43

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-05-30 09:33:27 +02:00
Wim Taymans
63d2102594 alsa: do resync based on current measurements
Call update time with the currently measured delay and then resync when
needed. Previously we would do the resync in the next cycle.

See #2257
2022-05-27 21:20:51 +02:00
Wim Taymans
3e7f975f83 utils: fix reallocarray macro 2022-05-27 16:06:41 +02:00
Wim Taymans
7e4f99512f v4l2: cast varargs to the right type
The controls have 64 bits but the int varargs expect an int value, which
is not always 64 bits.

See #2400
2022-05-27 13:30:07 +02:00
Fabrice Fontaine
0708a39b43 src/pipewire/utils.h: fix build without reallocarray
Fix the following build failure without reallocarray (e.g. on uclibc):

/home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mipsel-buildroot-linux-uclibc/10.3.0/../../../../mipsel-buildroot-linux-uclibc/bin/ld: src/pipewire/libpipewire-0.3.so.0.351.0.p/introspect.c.o: in function `pw_node_info_merge':
/home/buildroot/autobuild/instance-0/output-1/build/pipewire-0.3.51/build/../src/pipewire/introspect.c:216: undefined reference to `reallocarray'

Fixes:
 - http://autobuild.buildroot.org/results/374582f75713c4116ae23f972c5bc55214879502

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-05-27 11:22:13 +00:00
George Kiagiadakis
bd37d78a8c libcamera: advertise the device.product.name and not some random description
We can override the description with a localized one in the session
manager, instead, like it's done in alsa
2022-05-26 19:18:35 +03:00
Wim Taymans
96472e259f libcamera: return empty controls instead of error 2022-05-26 18:11:06 +02:00
George Kiagiadakis
cd8ac5c1a6 libcamera: add camera location property on nodes 2022-05-26 10:41:02 +00:00
Gabriel Dougherty
d4efdb44e3 Add uninstall instructions 2022-05-26 10:39:56 +00:00
Wim Taymans
9071678643 spa: set port flags on port info 2022-05-26 10:39:31 +02:00
Wim Taymans
16f1d6349d alsa: don't crash on NULL params 2022-05-25 15:33:18 +02:00
Wim Taymans
57e732cd27 pulse-server: use 8 channels internally for TrueHD and DTSHD
So that the stride is what the server side expects.

See #2284
2022-05-23 18:54:18 +02:00
Anders Jonsson
2307557652 po: Update Swedish translation 2022-05-23 15:39:58 +00:00
Trent Gord
799f4ce0a6 Update 90-pipewire-alsa.rules (ID 9886:0045 is for the Astro A20 Gen2) 2022-05-23 01:19:20 +00:00
Wim Taymans
840fa000eb man: escape |
It is used for delimiting a reference.
2022-05-21 19:46:02 +02:00
Piotr Drąg
d51a987190 Update Polish translation 2022-05-21 17:06:28 +00:00
James Hilliard
4738c934bb Fix build on uclibc without locale support
When uclibc is build with !UCLIBC_HAS_LOCALE the macro
__LOCALE_C_ONLY will be set, use this to disable unsupported and
not required(due to only supporting the C locale) locale functions.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-05-21 16:59:54 +00:00
Félix Poisot
5daa660a62 jack: replace unmatched atomic store with mutex
Fixes #1867, as this is the only u64 atomic access in the tree

All other accesses to pw_node_activation::sync_timeout are unprotected,
so they must assume lock ownership
2022-05-21 16:55:34 +00:00
Barnabás Pőcze
893567bed6 pulse-server: module-x11-bell: initialize module member
Previously, `module_x11_bell_data::module` was not initialized
properly, which led to a NULL pointer dereference in
`module_schedule_unload()` when called from `module_destroy()`
in case the native pipewire module was unloaded.

See #2392
2022-05-21 18:45:25 +02:00
Wim Taymans
700b1e7ff8 man: update pw-cat man page 2022-05-20 08:23:43 +02:00
Wim Taymans
81eee88dd8 pw-cat: support stdin/stdout for input/output
A - filename will read or write from the stdin/out.

Fixes #2387
2022-05-20 08:03:03 +02:00
Wim Taymans
b81b7febee pulse-server: don't export NETWORK nodes
Don't export network nodes with zeroconf.

Fixes #2384
2022-05-18 20:40:46 +02:00
Wim Taymans
05deba85a4 pulse-server: reset message length when freeing
When we move a message to the free list, reset the length to 0.
Otherwise the previous length plus the new length will be used to
allocated the message size, which would overallocate.
2022-05-18 17:31:23 +02:00
Wim Taymans
6ed91ae0d8 pw-cat: add -P option
Add -P option to pass custom properties to the stream.
2022-05-18 17:31:18 +02:00
Wim Taymans
e1a50a6c1a mixer-dsp: handle input offset
Handle the input buffer offset and clamp the size to maxsize.
2022-05-18 09:24:08 +02:00
Wim Taymans
411b12f59e audioadapter: improve error reporting
Improve the debug_params output.
Always either print the failed filter or that there was no filter.
Print the index of the enumerated failed param or a message when
there are no params.

See #2383
2022-05-17 09:52:48 +02:00
Barnabás Pőcze
970b5906a8 pipewire: module-spa-node-factory: remove resource listener when node is destroyed
Previously, the resource listener was not removed when
the `node_data` object was freed, which could lead to
a use-after-free when the resource emitted an event
later.

==2787072==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000016728 at pc 0x7ffff7175b52 bp 0x7fffffffb930 sp 0x7fffffffb920
WRITE of size 8 at 0x61d000016728 thread T0
    #0 0x7ffff7175b51 in spa_list_remove ../spa/include/spa/utils/list.h:77
    #1 0x7ffff717cb5a in pw_resource_destroy ../src/pipewire/resource.c:335
    #2 0x7ffff7051c56 in pw_global_destroy ../src/pipewire/global.c:417
    #3 0x7ffff6f82a68 in registry_destroy ../src/pipewire/impl-core.c:130
    #4 0x7ffff3a5f349 in registry_demarshal_destroy ../src/modules/module-protocol-native/protocol-native.c:784
    #5 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
    #6 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
    #7 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
    #8 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
    #9 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #10 0x555555559722 in main ../src/daemon/pipewire.c:131
    #11 0x7ffff62a528f  (/usr/lib/libc.so.6+0x2928f)
    #12 0x7ffff62a5349 in __libc_start_main (/usr/lib/libc.so.6+0x29349)
    #13 0x5555555582a4 in _start (./src/daemon/pipewire+0x42a4)

0x61d000016728 is located 2216 bytes inside of 2264-byte region [0x61d000015e80,0x61d000016758)
freed by thread T0 here:
    #0 0x7ffff798c672 in __interceptor_free /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52
    #1 0x7ffff70f9bc3 in pw_impl_node_destroy ../src/pipewire/impl-node.c:1880
    #2 0x7ffff70d1d57 in global_destroy ../src/pipewire/impl-node.c:638
    #3 0x7ffff7051a4f in pw_global_destroy ../src/pipewire/global.c:414
    #4 0x7ffff6f82a68 in registry_destroy ../src/pipewire/impl-core.c:130
    #5 0x7ffff3a5f349 in registry_demarshal_destroy ../src/modules/module-protocol-native/protocol-native.c:784
    #6 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
    #7 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
    #8 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
    #9 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
    #10 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #11 0x555555559722 in main ../src/daemon/pipewire.c:131
    #12 0x7ffff62a528f  (/usr/lib/libc.so.6+0x2928f)

previously allocated by thread T0 here:
    #0 0x7ffff798d411 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x7ffff70e5bb7 in pw_context_create_node ../src/pipewire/impl-node.c:1192
    #2 0x7ffff28c748e in pw_spa_node_new ../src/modules/spa/spa-node.c:112
    #3 0x7ffff28c9a9f in pw_spa_node_load ../src/modules/spa/spa-node.c:276
    #4 0x7ffff28c1618 in create_object ../src/modules/spa/module-node-factory.c:134
    #5 0x7ffff7106c4e in pw_impl_factory_create_object ../src/pipewire/impl-factory.c:273
    #6 0x7ffff6f86dd7 in core_create_object ../src/pipewire/impl-core.c:349
    #7 0x7ffff3a5cba9 in core_method_demarshal_create_object ../src/modules/module-protocol-native/protocol-native.c:680
    #8 0x7ffff3a2c9ed in process_messages ../src/modules/module-protocol-native.c:352
    #9 0x7ffff3a2e2ea in connection_data ../src/modules/module-protocol-native.c:423
    #10 0x7ffff3e09402 in source_io_func ../spa/plugins/support/loop.c:427
    #11 0x7ffff3e0851d in loop_iterate ../spa/plugins/support/loop.c:409
    #12 0x7ffff709c21d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #13 0x555555559722 in main ../src/daemon/pipewire.c:131
    #14 0x7ffff62a528f  (/usr/lib/libc.so.6+0x2928f)

SUMMARY: AddressSanitizer: heap-use-after-free ../spa/include/spa/utils/list.h:77 in spa_list_remove
2022-05-16 17:40:35 +00:00
jasker5183
6b619dd1b3 Doxygen - enable client side search engine. 2022-05-16 15:33:27 +00:00
Wim Taymans
b1578ee109 alsa: avoid allocation 2022-05-16 09:36:14 +02:00
Robert Rosengren
cd389240fa alsa-plugin: use ioplug sw_params callback
snd_pcm_sw_params states "The software parameters can be changed at
any time.". Adding the ioplug callback sw_params to get relevant
updates, and if min_avail has changed update the node latency of
the stream.

Ignoring callback received prior to prepare as stream not yet created.
2022-05-16 09:33:01 +02:00
Pauli Virtanen
98aa7ccff0 pulse-server: emulate synchronous MOVE_* commands
Make MOVE_SINK_INPUT/MOVE_SOURCE_OUTPUT change the linked peer
immediately in subsequent GET_SINK_INPUT_INFO/GET_SOURCE_OUTPUT_INFO
commands.  Do this by keeping track of the sink/source where the client
moved the stream to, and temporarily replying so in future GET_INFO (but
only in messages for that client).

We discard the temporary override when we either get an update event for
the stream (i.e. SM moved the stream), or a 1sec timer runs out. If the
timer runs out, we emit a sink-input/source-output change event, as in
that case what we claimed in the earlier GET_INFO messages might not be
true, so clients need to update their information.

This gets rid of race conditions where an application moves a stream,
and expects the move to be visible in future GET_INFO replies, which may
fail to happen because it takes some time for the session manager to
re-link the streams.

Fixes pasystray behavior.
2022-05-15 17:14:52 +00:00
Pauli Virtanen
83be5d866f pulse-server: implement temporary data attached to manager objects
Add functions for setting timer-based lifetimes for object data.

Having the timers in the object data themselves simplifies life cycle
management, as client/manager disconnects are handled without further
work.
2022-05-15 17:14:52 +00:00
Oğuz Ersen
36ad886388
po: Update Turkish translation 2022-05-14 18:38:15 +03:00