Commit graph

6778 commits

Author SHA1 Message Date
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
Peter Hutterer
3c798ea413 test: force TMPDIR to /tmp if it is unset
This way we can rely on it everywhere without having multiple checks for it.
2021-06-21 07:17:10 +00:00
Peter Hutterer
00bc5f0e3b test: drop duplicate init of test->result
Set to the same value 5 lines above
2021-06-21 07:17:10 +00:00
Huang-Huang Bao
ea28cb95c0 bluez5: don't autoconnect device if no profiles
Otherwise timers would be created for every bluetooth devices, even they don't have audio profiles.
2021-06-21 07:10:02 +00:00
Huang-Huang Bao
db6e73895f bluez5: clean up connection status handling
Also separate device info emitting into a new function.
2021-06-21 07:10:02 +00:00
Huang-Huang Bao
3433f40cd9 bluez5: fix device connection issue if profile(UUIDs) info is delayed
Keep all types of devices, only emit device info if device has audio profiles.
Heuristically add profiles based on bluez actions so device can still be connected
even without initial UUIDs info from signal InterfaceAdded for org.bluez.Device1.

Fixes #1330
2021-06-21 07:10:02 +00:00
Pauli Virtanen
b44fdf5ebb bluez5: backend-native: don't send +BCS if no codec negotiation
Fix issue with sending +BCS for CVSD even though codec negotation is not
available for the RFCOMM.
2021-06-20 19:40:00 +03:00
Wim Taymans
a19ab4a20a use builddir everywhere
So that it matches thr INSTALL.md instructions
2021-06-20 12:00:26 +02:00
dreamer
e1036ee0fc set the same builddir as INSTALL.md 2021-06-19 21:19:56 +02:00
Barnabás Pőcze
80e3da9b01 pulse-server: add missing minus sign
Noticed by @QuLogic.

Fixes: 87c00a6f00 ("pulse-server: add missing EWOULDBLOCK check")
2021-06-19 17:28:03 +00:00
George Kiagiadakis
2723b0c6e2 meson: export plugin and data dirs for other projects to find them
SPA_PLUGIN_DIR is exported in pkgconfig as 'plugindir'
PIPEWIRE_MODULE_DIR is exported as 'moduledir'
PIPEWIRE_CONFIG_DIR is exported only in uninstalled environments
as 'confdatadir' (not making this public due to the possible upcoming
configuration changes in pipewire)

All variables are also exported on the meson dependency objects,
so that subprojects can find them.

Wireplumber can then find them like this:

  pipewire_moduledir = pipewire_dep.get_variable(
    pkgconfig: 'moduledir', internal: 'moduledir', default_value: '')

... and this works regardless of whether wireplumber is being
configured as a subproject or using the uninstalled pkgconfig files
or using the system installation of pipewire.

This is required in order to run wireplumber tests in the
uninstalled environment with 'meson test'
2021-06-18 19:24:28 +03:00
George Kiagiadakis
9e0ce7cbd6 ci: install a more recent meson in the ubuntu 20.04 image 2021-06-18 18:06:28 +03:00
George Kiagiadakis
7ee5172ce8 meson: integrate wireplumber as a subproject
This allows building wireplumber as part of the pipewire build
and running it in the uninstalled environment instead of media-session.

Building each session manager is individually contolled by the options:
 -Dmedia-session=auto/enabled/disabled
 -Dwireplumber=auto/enabled/disabled

And controlling which one is used in pipewire.conf is done with:
 -Dsession-manager=media-session/wireplumber

Wireplumber's source tree must be in subprojects/wireplumber/
If this is missing, the .wrap file ensures that the latest git
master is downloaded while meson configures the build.
This git tree will not be automatically updated later, you need
to ensure that it is up-to-date on your own.
2021-06-18 17:54:18 +03:00
George Kiagiadakis
7ab5c35cad meson: declare spa_dep and override_dependency() for spa and pipewire
This allows meson subprojects (or projects using pipewire as a meson
subproject) to be able to use dependency('libpipewire-0.3') and
dependency('libspa-0.2') to find the uninstalled versions of these
libraries directly from the build dir instead of going through pkg-config
2021-06-18 17:54:18 +03:00
George Kiagiadakis
19bcdaebe2 meson: use newer version of pkgconfig.generate()
pkgconfig.generate() takes a positional argument, which
is the library target for which to generate a pkgconfig file

The previous way of adding the libpipewire target in
the libraries list is deprecated in recent meson
2021-06-18 17:54:18 +03:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
George Kiagiadakis
953dc22f50 src: move extensions into pipewire
This allows having the same directory structure for headers as it
is in $prefix/include when installed, so that we can build other
projects using pipewire uninstalled (via the -uninstalled.pc or
by using meson subprojects). Otherwise, external code that reasonably
includes <pipewire/extensions/foo.h> fails to compile.
2021-06-18 17:54:18 +03:00
Wim Taymans
1f04e911c5 module: handle work queue create errors
Handle NULL when creating a work queue instead of crashing. The
create can fail when we run out of fds.
2021-06-18 16:29:23 +02:00
Wim Taymans
bbbc79647f pulse-server: return INTERNAL error for ENFILE/EMFILE 2021-06-18 15:56:55 +02:00
Wim Taymans
05c633a4f5 profiler: Fix crash with many streams
Write the profiler data to an allocated buffer instead of the stack
so that we can make it a little larger.

Don't try to process the data when the builder had to truncate it
because it didn't fit.
2021-06-18 15:42:14 +02:00
Wim Taymans
4518eded5b context: clean up the settings object as well 2021-06-18 15:26:20 +02:00
Wim Taymans
1662e3834f impl-metadata: don't leak the property 2021-06-18 15:26:20 +02:00
Wim Taymans
fb992c3f2d impl-metadata: use the metadata method
so that we call the method of the actual implementation, not our
own implementation.
2021-06-18 15:26:20 +02:00
Wim Taymans
def0caf281 pulse-server: handle out-of-files better
When we don't have enough files to accept the connection, clear the
_IN flag so that we don't try to accept if over and over again.
When a client disconnects, set the flag again so that we try to
accecpt new connections again.

See #1305
2021-06-18 15:26:20 +02:00
Wim Taymans
22b5b6b120 connection: make sure we don't overrun the fd array
Do some checks on the fd array and error out when we would overrun.
2021-06-18 15:26:20 +02:00