Commit graph

7016 commits

Author SHA1 Message Date
Peter Hutterer
0261b78870 doc: expand the module doc a bit
Makes it feel slightly more complete, even if the example modules are
currently undocumented.
2021-07-30 07:24:24 +00:00
Peter Hutterer
c753f45598 doc: remove the PipeWire prefix from the nested pages
They're structured below PipeWire in the doxygen output, so we don't
need this as part of the header.
2021-07-30 07:24:24 +00:00
columbarius
06b03aef57 example: check which endian sdl is using
enum spa_video_format uses explicit big endian, while sdl can be either.
We need to adapt the convertion table accordingly.
2021-07-30 07:23:55 +00:00
Simon Ser
6773ea7e5e doc: add DMA-BUF docs 2021-07-29 19:18:49 +00:00
Wim Taymans
393f3e6d05 pulse-server: align format to pulseaudio json message format
PulseAudio uses json now as the message format. Reformat our output
and parse our input accordingly.
2021-07-29 20:55:44 +02:00
Neal Gompa
1216371f8c bluez5: Use libfreeaptx instead of libopenaptx
libfreeaptx is a fork of libopenaptx prior to the dubious licensing
situation was introduced to the library.

As it's fully API compatible, let's use that instead for those who
want to use aptX support.

The library source is available at https://github.com/iamthehorker/libfreeaptx
2021-07-29 15:22:04 +00:00
Wim Taymans
08a1ca403f context: add option for soft/hard clock rate changes
Hard rate changes (the default now) makes the graph suspend so that the
driver reopens the device with the new sample rate if possible. This
causes a glitch.

Soft rate changes works as before and just changes the clock rate of
the position area, which makes everything resample things to the new
rate without a glitch.

Sample rate changes can currently still only be triggered by
configuring the settings metadata clock.force-rate
2021-07-29 17:13:54 +02:00
Wim Taymans
65e7402d01 context: log rate changes
We don't need to check, rt.position of a node is never NULL.
Check if the rate changed and log an info message, just like we do
for the quantum.
2021-07-29 16:50:39 +02:00
Wim Taymans
ebf4bf8d83 context: don't follow links to inactive nodes
We don't need to follow nodes that we already visited or that are
inactive so skip them early.

Always try to prepare the link otherwise, not only for passive links
because non-passive links might also be paused because of a suspended
driver.
2021-07-29 16:43:54 +02:00
Wim Taymans
7092effaab media-session: add info when suspending a node 2021-07-29 16:38:33 +02:00
Wim Taymans
158c23b2fd impl-link: prepare link only between active nodes
We only ever want to prepare a link between active nodes so add the
check in the _prepare() functions instead. This also makes it skip
the prepare step for inactive nodes when recalculating the graph.
2021-07-29 16:33:00 +02:00
Wim Taymans
2dabd337dc audioconvert: clear negotiated rate
When we clear the format on the non-dsp port, set the rate back to
0 so that we can negotiate a new rate if needed.
2021-07-29 13:35:41 +02:00
Peter Hutterer
4496aed5a6 doc: revamp the pipewire-access page
Rewording, linking to the various things, etc.
2021-07-29 16:06:36 +10:00
Peter Hutterer
d1c80183d9 doc: add a media-session header file with the access-flatpak module
This adds a new top-level documentation entry for pipewire-media-session
with a list of modules (currently only one). Similar setup to the
pipewire modules, it allows us to document all modules in-place.
2021-07-29 16:06:36 +10:00
Peter Hutterer
c03fedbac2 doc: reword the Design page 2021-07-29 14:43:40 +10:00
Peter Hutterer
6da0ee6cb5 doc: move the overview page out to its own page
This is a good first (top) page to have in the docs, let's move it out
from the pipewire heading.

This doesn't change any of the links and the renaming isn't required
(subpage controls whether it's a top-level item and the meson.build
 order decides its spot in he list). Still, better to have the filenames
represent the layout.
2021-07-29 14:33:09 +10:00
Peter Hutterer
85435cd525 doc: improve the pipewire-audio page for readability
Typos, some header changes, etc.
2021-07-29 14:26:01 +10:00
Peter Hutterer
7871f33da6 doc: remove the Pipewire prefix from some of the doc pages 2021-07-29 14:26:01 +10:00
Peter Hutterer
f0152b6a0a doc: add the new documentation pages to the docs
And make them a subpage of the Pipewire topic
2021-07-29 14:25:01 +10:00
Peter Hutterer
4e90760155 spa: silence a doxygen warning
warning: documented symbol 'spa_log_error foo' was not declared or defined.
2021-07-29 14:03:00 +10:00
Wim Taymans
44583367db pod: add prop option to avoid fixation
Add a DONT_FIXATE flag to spa_pod_props. The flag avoids fixation
of the property by spa_pod_fixate().

When filtering properties, 'and' the flags together in the filtered
property. This mostly preserves the merged property flags. It also
merges the DONT_FIXATE flags so that when both sides can handle
the non-fixated result, it will be returned.

This can be used to let PipeWire filter out the common property
fields and leave the final selection of fields to the producer. This can
only work when the final selected field can be transported in some
other way than the format param, like on the buffer fields or in
metadata. One use case is negotiation of the DMABUF modifiers.

See #1084
2021-07-28 11:03:26 +02:00
Wim Taymans
4e087caa2b jack: add per client match rules
This makes it possible to configure per client settings such as
latency and later also to lock the quantum for certain clients.

See #1456
2021-07-27 17:57:30 +02:00
Wim Taymans
d2826a5dab jack: emit client unregister event
Because we only remove the client from the list after doing the lookup,
we will always find the removed node and the unregister event is
never called.

Fix this by marking the object as removing so that the lookup function
can skip the nodes being removed.
2021-07-27 12:07:33 +02:00
Wim Taymans
8e8cb34dc2 protocol: don't place sockets in $HOME
No server will put them there and no client will look for it there.
2021-07-27 10:57:31 +02:00
Peter Hutterer
b70a3dca85 protocol-native: don't initialize sockets in $HOME
Leaving sockets in the home directories is bad form, so let's not do
this.

This effectively requires XDG_RUNTIME_DIR to be set for pipewire to
work - it is set correctly on most setups anyway and on custom setups
this needs to be addressed with a custom environment.

Fixes #1443
2021-07-27 08:23:23 +00:00
Peter Hutterer
5c78cbd356 ci: add a build test for buildtype=release 2021-07-27 10:24:44 +10:00
Peter Hutterer
49f3d5842e test: replace all spa_assert() macros with spa_assert_se()
These are tests, we never want those to be optimized away.
2021-07-27 10:24:44 +10:00
Peter Hutterer
63d833dabf spa: use spa_assert_se() for bugs in the util string functions
These are programming bugs that should never happen, so let's always
abort.
2021-07-27 10:24:44 +10:00
Wim Taymans
40f1d2b881 jack: only call callbacks when active
JACK applications expect the callbacks only when activated.

Fixes #1461
2021-07-26 23:03:55 +02:00
Wim Taymans
dd5b460daa client-node: remove custom target signal
The target signal is called when the peer nodes are ready and this
node needs to be scheduled. It is the in-process version of the
signal.

Remove our custom version that, just like the default version, schedules
the node implementation but doesn't do any accounting.

Makes pw-top report driver stats for bluetooth devices.

Fixes #1450
2021-07-26 15:46:21 +02:00
Wim Taymans
9f6890e10e pulse-server: improve stream cleanup
First disconnect the stream this ensures no more process events are
called. Then flush out the pending events, then destroy the stream.

Fixes #1451
2021-07-26 11:48:00 +02:00
Wim Taymans
78f52a7073 loop: avoid corruption of ringbuffer
The ringbuffer can't be written to from multiple threads.

When both the main loop and data thread do _invoke, they both write to
the ringbuffer and cause it to be corrupted because the ringbuffer is
not multi-writer safe.

Doing invoke from the thread itself is usually done to flush things out
so we really only need to flush the ringbuffer and call the callback.

See #1451
2021-07-26 11:39:48 +02:00
Wim Taymans
d1905716e4 impl-node: Split ALWAYS_PROCESS and WANT_DRIVER handling
Make a new PW_KEY_NODE_WANT_DRIVER to assign the node to a running
driver. (does not work yet)
Use a new variable to hold the ALWAYS_PROCESS setting and also
update want_driver.
This makes things it a bit more future proof.
2021-07-26 10:38:06 +02:00
Wim Taymans
62fa0823ec modules: virtual sink/sources need driver
Virtual sinks and sources implemented with streams need to be grouped
with a driver node to be able to schedule. We don't have a way to let it
use a default driver so add it to the pipewire.dummy driver.

This fixes stalled pipe and other streams streams.

Fixes #1407
2021-07-26 10:21:44 +02:00
Wim Taymans
16faacec92 pulse-server: don't compare string pointers
We always want to clear the provided blocklist from the properties. The
logic tries to only clear when there was a blocklist but it checks this
by comparing the string pointer to the fallback, which gives a compiler
warning.
2021-07-26 09:39:55 +02:00
Wim Taymans
ab99f4d027 doc: add general audio configuration 2021-07-26 09:35:05 +02:00
Barnabás Pőcze
b6405b761f pulse-server: use sizeof() instead of hard-coding
Use `sizeof("/pid")` instead of hard-coding 5
in the condition.
2021-07-25 15:17:08 +02:00
Barnabás Pőcze
627ef37a77 pulse-server: use pid_t where appropriate
Instead of `int`, use the `pid_t` type to represent
process identifiers.
2021-07-25 15:17:08 +02:00
Barnabás Pőcze
2d27497045 pulse-server: use S_ISDIR()
Use the `S_ISDIR()` macro instead of `S_IFMT` and bitwise operations
to make the code simpler.
2021-07-25 15:17:08 +02:00
Barnabás Pőcze
e90a70fd49 pulse-server: check if a runtime directory could be found
Print an error message and return an error code if all
options have been exhausted without success.
2021-07-25 15:17:08 +02:00
Barnabás Pőcze
30e3884a75 pulse-server: add another check for the return value of snprintf()
In addition to checking if the resulting string would
be too long, also check whether or not snprintf failed.
2021-07-25 15:17:08 +02:00
Barnabás Pőcze
67b422fa18 pulse-server: fix potential use of dangling pointer
`getpwuid_r()` puts the strings pointed to from the returned
passwd struct into the specified buffer. Previously, that
buffer technically didn't live long enough to be usable
in the `snprintf()` call - although in practice this didn't
appear to be a problem. A particular version of GCC 11 generates
the same machine code for this function regardless whether
this patch is applied or not. Still, fix this by moving
the buffer to an outer scope.
2021-07-25 15:17:08 +02:00
Peter Seiderer
6af1388d66 meson: fix getrandom detection for uclibc
The getrandom() detection from meson.build fails with the following error
message:

  .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:27:35: error: unknown type name 'size_t'
     27 | extern int getrandom(void *__buf, size_t count, unsigned int flags)
        |                                   ^~~~~~
  .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:8:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?

Fix it by adding stddef.h include to the meson getrandom() detection.

Fixes:

  ../src/pipewire/impl-core.c:54:9: error: conflicting types for ‘getrandom’
     54 | ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
        |         ^~~~~~~~~
  In file included from ../src/pipewire/impl-core.c:34:
  .../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:27:12: note: previous declaration of ‘getrandom’ was here
     27 | extern int getrandom(void *__buf, size_t count, unsigned int flags)
        |            ^~~~~~~~~

[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/pipewire/0001-meson-fix-getrandom-detection-for-uclibc.patch]
2021-07-25 11:17:41 +00:00
Philippe Normand
8b5601947c gst: Fix logging in buffer_recycle()
The first argument should be a GObject. GstMiniObjects are not GObject.
2021-07-25 11:17:18 +00:00
Pauli Virtanen
1f0934862a bluez5: add device to blocklist 2021-07-25 11:16:36 +00:00
Pauli Virtanen
777bc89d02 pipewire-pulse: add module-switch-on-connect
module-switch-on-connect sets the configured default sink/source
whenever suitable new sink/sources appear.

This should give the same behavior as Pulseaudio's module.

This module exists mainly to provide a workaround e.g. for desktop
environments such as XFCE, whose mixer applications try to manage the
default devices assuming fully PA-like behavior, breaking default
pipewire output switching.
2021-07-24 18:51:57 +03:00
Pauli Virtanen
606108f409 spa: add spa_strstartswith 2021-07-24 14:36:03 +03:00
Wim Taymans
0346c616e2 doc: add midi doc
Reorganize the docs a little. First a short intro, then list the use
cases, then the responsabilities of the various components, then
the implementation in various places.
2021-07-23 11:05:59 +02:00
Javier Martinez Canillas
76cb5c1169 libcamera: remove unused buffer variable in LibCamera::stop()
To fix build warning about a variable being unused in LibCamera::stop():

[1/2] Compiling C++ object spa/plugins/libcamera/libspa-libcamera.so.p/libcamera_wrapper.cpp.o
../spa/plugins/libcamera/libcamera_wrapper.cpp: In member function ‘void LibCamera::stop()’:
../spa/plugins/libcamera/libcamera_wrapper.cpp:531:58: warning: unused variable ‘buffer’ [-Wunused-variable]
  531 |                 for (const std::unique_ptr<FrameBuffer> &buffer : this->allocator_->buffers(stream)) {
      |                                                          ^~~~~~
2021-07-23 07:59:10 +00:00
Javier Martinez Canillas
5471a0018b libcamera: fix no-longer existent <libcamera/buffer.h> header inclusion
The SPA plugin is including a <libcamera/buffer.h> header file, but this
got renamed to <libcamera/framebuffer.h> to match the defined class name:

../spa/plugins/libcamera/libcamera_wrapper.cpp:52:10: fatal error: libcamera/buffer.h: No such file or directory
   52 | #include <libcamera/buffer.h>
      |          ^~~~~~~~~~~~~~~~~~~~

Fixes #1435
2021-07-23 07:59:10 +00:00