Commit graph

7002 commits

Author SHA1 Message Date
Barnabás Pőcze
738b764253 pulse-server: do not define NAME in header
Part of !776.
2021-06-25 03:22:54 +02:00
Barnabás Pőcze
8208e60b33 pulse-server: add include guard to defs.h
Part of !776.
2021-06-25 03:21:38 +02:00
Wim Taymans
5e9f6c8ecc jack: use system:monitor_ prefix for monitor ports 2021-06-24 20:31:55 +02:00
Niklāvs Koļesņikovs
d7cddbdb61 meson: changes meson switches for controlling session manager
Some distributions set --auto_features=enabled which messes with the
internal logic of the build system when features are used for other
purposes than pure dependency control. The only solution is to either
avoid the value auto or change the type of the option to non-feature.

This commit does the later by replacing -Dmedia-session, -Dwireplumber
and -Dsession-manager with the new -Dsession-managers array and
-Ddefault-session-manager combo options.

Fixes #1333
Fixes #1336
2021-06-24 14:22:13 +00:00
Wim Taymans
016f02616b json: don't escape / 2021-06-24 16:18:59 +02:00
Wim Taymans
2acf29a86c Revert "json: also escape '/' as required by JSON"
This reverts commit eb8546a682.

We don't need to escape the / according to  RFC7159
2021-06-24 16:12:47 +02:00
Wim Taymans
679df3f9d9 v4l2: implement latency get and set 2021-06-24 16:05:31 +02:00
Wim Taymans
7ef78b4464 jack: add extra object check
Make an invalid object type and mark removed objects as invalid.
Make sure we don't reference an invalid object for the various
callbacks and methods.

See #1265
2021-06-24 15:49:59 +02:00
Peter Hutterer
01c2cb3d45 test: shut up coverity complaints about side effects
CID 1457494:  Incorrect expression  (ASSERT_SIDE_EFFECT)
Assignment "ai = (void *)((uint8_t *)pod + 16)" has a side effect.  This code will work differently in a non-debug build.
550             spa_assert((ai = SPA_POD_ARRAY_VALUES(pod)) != NULL);

Patch generated with coccinelle snippet
	@@
	expression E1, E2;
	@@
	- spa_assert((E1 = E2) != NULL);
	+ E1 = E2;
	+ spa_assert(E1 != NULL);

And run again for == NULL
2021-06-24 11:14:27 +00:00
Sanchayan Maity
badb76147f module-protocol-pulse: Add module-roc-source 2021-06-24 11:04:23 +00:00
Sanchayan Maity
e60498df51 module-protocol-pulse: Add module-roc-sink 2021-06-24 11:04:23 +00:00
Peter Hutterer
50e015fa87 doc: add a reference to the PipeWire Under The Hood post
A good writeup that provides more details than our own documentation, so
let's at least link to it.
2021-06-24 10:54:13 +00:00
Peter Hutterer
0f0565175e doc: rework the SPA plugin documentation
Add more info to the main SPA page and split the design vs plugin pages up,
together with some more documentation to ideally lower make this easier to
understand on a glance.

Most of the actual plugin loading documentation are unmodified.
2021-06-24 10:54:13 +00:00
Peter Hutterer
8a25076c4e doc: define __USE_ISOC11 for doxygen to pick up the logger #defines
This way doxygen will pick up the #defines for spa_log_error, etc. Without
this define it uses the else part of the condition which uses macros to
construct function names.
2021-06-24 10:54:13 +00:00
Wim Taymans
17f02d8c6d filter: refactor function to fix the datatype 2021-06-24 12:50:37 +02:00
Wim Taymans
48e6e41d95 audioconvert: improve latency handling
When setting the Latency parameter on one side of the converter, set
it also on the other size. We should actually implement propagating
the latency through all the elements of the converter later.

Implement latency handling on fmtconvert.

merger and splitter change latency on all ports when on port changes.

All this makes the configured and exposed latencies visible on all
ports from adapter.
2021-06-24 12:20:44 +02:00
Wim Taymans
22fe0b293a audioconvert: add some more debug 2021-06-24 12:11:38 +02:00
Wim Taymans
8ee9a7b5e5 audioadapter: latency is writable 2021-06-24 12:07:06 +02:00
Wim Taymans
f03f1926e3 seq: track port latency 2021-06-24 10:04:19 +02:00
Wim Taymans
4c09eb227f alsa: rename indexes into port and node params 2021-06-24 10:03:41 +02:00
Wim Taymans
8cf5927e95 alsa: keep track of input and output latency
track and report both input and output latency.
2021-06-24 09:59:48 +02:00
Konstantin Kharlamov
ed9560fb03 alsa: fix "now.tv_sec maybe used uninitialized" warnings
Fixes a number of warnings that look like this:

    In file included from ../spa/include/spa/utils/result.h:37,
                     from ../spa/plugins/alsa/alsa-seq.c:35:
    In function ‘set_timers’,
        inlined from ‘do_reassign_follower’ at ../spa/plugins/alsa/alsa-seq.c:909:2:
    ../spa/include/spa/utils/defs.h:191:39: warning: ‘now.tv_sec’ may be used uninitialized [-Wmaybe-uninitialized]
      191 | #define SPA_TIMESPEC_TO_NSEC(ts) ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec)
          |                                   ~~~~^~~~~~~~
    ../spa/plugins/alsa/alsa-seq.c:840:28: note: in expansion of macro ‘SPA_TIMESPEC_TO_NSEC’
      840 |         state->next_time = SPA_TIMESPEC_TO_NSEC(&now);
          |                            ^~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/alsa-seq.c: In function ‘do_reassign_follower’:
    ../spa/plugins/alsa/alsa-seq.c:836:25: note: ‘now’ declared here
      836 |         struct timespec now;
          |                         ^~~

The reason for these warnings is that spa_system_clock_gettime() may
fail if a version check fails, but the code in question didn't check for
the possible fail. If it failed, then execution would continue, and the
arguments that were passed to the macro will be used uninitialized.

Fix this by checking whether function succeeded.
2021-06-22 22:42:25 +03:00
Konstantin Kharlamov
252e798ece alsa: remove unused res variable in alsa_on_timeout_event 2021-06-22 22:42:25 +03:00
George Kiagiadakis
5ee9133b60 alsa plugin: allow specifying a media.role on the virtual device name
So that we can do:
  aplay -D pipewire:ROLE=Music music.wav
  aplay -D pipewire:ROLE=Notification notice.wav
2021-06-22 14:48:31 +00:00
Wim Taymans
575d4456e1 tests: fix test 2021-06-22 16:31:51 +02:00
Wim Taymans
f5f79cc0b9 filter: implement enum and set_param on the filter 2021-06-22 16:29:40 +02:00
Wim Taymans
79866a93cd Param: add process latency param and info 2021-06-22 16:29:29 +02:00
Wim Taymans
8c77713a7b jack: don't emit connect callback with unknown ports
Lookup of globals needs a thread lock or context lock. There is no
need to take the context lock when we already have the thread lock.

Make a new method to find an object of a type.

Check that link objects are referencing valid ports. Check that the
connect callback is referencing valid ports.

Only return connections with valid ports.

See #1265
2021-06-22 11:16:45 +02:00
Pauli Virtanen
b98b9e0e77 bluez5: deal with old libusb versions 2021-06-22 10:58:50 +03:00
Pauli Virtanen
9d38d375d2 bluez5: add and use quirk for broken mic HW volume
Some headsets emit AT+VGM even though +VGM commands do not actually
adjust the recording volume.
2021-06-22 10:58:50 +03:00
Pauli Virtanen
4899b75410 media-session: add hardware volume quirks
Data from interop list in AOSP Fluoride stack.
2021-06-22 10:58:50 +03:00
Pauli Virtanen
9422e76d89 bluez5: enable hw volume on all profiles, if device quirks permit it 2021-06-22 10:58:50 +03:00
Pauli Virtanen
5e0b63b149 bluez5: backend-native: use quirks + usb adapter caps for checking msbc
Use the quirks database to check whether to enable MSBC codec for each
device.

If quirks don't allow ALT1 mode for an USB adapter, check whether the
adapter has an usable ALT6 mode and disable MSBC if not.
2021-06-22 10:58:50 +03:00
Pauli Virtanen
b57ae8c2a6 bluez5: add support for hardware quirk/feature database
Implement hardware quirk/feature database with pattern matching.
2021-06-22 10:58:50 +03:00
Pauli Virtanen
88077a29db media-session: add bluez hw database conf files 2021-06-22 10:58:50 +03:00
Pauli Virtanen
2c9764da1d bluez5: parse bluez vendor/product ids
It seems few devices support the Device Id via bluez.

Try to figure out vendor/product ids for usb devices also via sysfs.
Also try to figure out the adapter bus type.
2021-06-22 10:58:50 +03:00
Wim Taymans
6c582d5445 filter: improve latency handling
Keep track of Latency params on ports. When adding a latency param,
parse and update the port latency info.

Add both input and output latency params on the port, even when only
one changed. Use the stored info to do this.

Implement a default latency handler that simply combines and forwards
the Latency settings on ports.

Add a CUSTOM_LATENCY flag that allows you to bypass the default
handler and implement custom logic.

See #911
2021-06-22 09:28:14 +02:00
Wim Taymans
368a12b6e9 filter: Initialize info before adding params
First initialize the port and node info, then add the params so that
the param_info flags are updated correctly. Otherwise, adding the
params would make the param readable but the init of the param_info
later would reset it back to 0 and the param would not be visible.
2021-06-22 09:21:04 +02:00
Wim Taymans
83b198215d filter: use the user param_info field for updates
Keep track of the number of updates in the user field and before
emiting the info, flip the serial flag. This makes it possible to
even emit updates when setting an even number of params.
2021-06-22 09:18:33 +02:00
Wim Taymans
a152ad95d5 filter: check port id and direction
Don't crash in case someone tries to access invalid direction or
port.
2021-06-22 09:15:53 +02:00
Peter Hutterer
28a9253622 pipewire: fix a doxygen group assignment 2021-06-22 15:48:48 +10:00
Konstantin Kharlamov
84acfbbda5 media-session: switch to the route when availability changed
When a user plugs in headphones, they expect to hear an audio through
them. Currently, that usecase might or might not work with pipewire
depending on the user's luck, because pipewire instead uses port
priorities, and those apparently rarely have sane default values.

PulseAudio ignored priorities here, instead it made use of the port
right away. This should better match user expectations (who plugged in
headphones and is expecting to hear sound), so let's do the same in
pipewire.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1170
2021-06-21 13:08:50 +00:00
Konstantin Kharlamov
3512977450 media-session: correct availability type
It is actually an enum, not a uint32_t
2021-06-21 13:08:50 +00:00
Niklāvs Koļesņikovs
dddbc285a8
meson_options.txt: replace auto with enabled/disabled where possible
For cases where auto has an always known value, explicitly set it for
the sake of clarity. This commit only deals with the most trivial uses
that do not require rewriting the internal logic and where auto is not
behaving in a third way that's distinct from both enabled and disabled.
2021-06-21 14:56:46 +03:00
Evgeniy Khramtsov
c3d7561d17 test: unbreak FreeBSD 2021-06-21 09:28:02 +00:00
Wim Taymans
6186fc775d jack: improve debug
Log info messages when a port and client are added/removed
Log an info message when port_by_name/id can't find the port.

See #1265
2021-06-21 11:25:17 +02:00
Wim Taymans
f85b0bfd16 pulse-server: Avoid overflow in stream read/write index
Keep separate counters for the ringbuffer and stream read/write
indexes.

The ringbuffer has 32 bits indexes while the pulse server is required
to keep 64 bit read/write indexes.

Also handle invalid seek flags.

Fixes #1331
2021-06-21 10:50:23 +02:00
Peter Hutterer
0a5ae1cf47 pipewire: drop \memberof declarations
This is obsolete since the move to doxygen groups and having \memberof blocked
the documentation in the source file from being merged with the header file.
2021-06-21 07:17:35 +00:00
Peter Hutterer
a4bdf83e39 test: explicitly ignore the read() result from the timerfd/pidfd
We don't care about the actual read() being successful - it won't be on pidfd
and on timerfd it's just a timestamp we don't need.
2021-06-21 07:17:10 +00:00
Peter Hutterer
f9985636de test: fail if we can't chdir to $TMPDIR
Otherwise our tests may have unpredictable behavior depending on leftover
files in $PWD.
2021-06-21 07:17:10 +00:00