Commit graph

6767 commits

Author SHA1 Message Date
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
Wim Taymans adee3d79b9 connection: handle truncated control data
We can't recover from truncated control data so return a fatal error
that should stop the client. Truncated control data can happen when
there are no more fds available, for example.

See #1305
2021-06-18 15:26:20 +02:00
George Kiagiadakis 8cf2f134b7 gstpipewiresink: also break the connection loop when the state is STREAMING
Under some schedulers (observed in a virtualbox VM), the state may
go from PAUSED to STREAMING before this code has a chance to test it
2021-06-18 13:34:35 +03:00
Michal Vasilek a870af02f0 module-rt: define RLIMIT_RTTIME if not defined
older versions of musl libc (before 1.2) don't define RLIMIT_RTTIME
2021-06-18 09:03:46 +00:00
Arun Raghavan 3272940731 echo-cancel: Don't use application name for stream node name
This is not too useful while looking at pipeline graphs, etc. We will
likely want to expand this to also include the module id or something to
distinguish multiple echo-cancel instances (which we can currently do
via the factory ID).
2021-06-17 17:04:35 -04:00
Arun Raghavan 2d251509db doc: Drop duplicate reference to pw_global 2021-06-17 16:39:06 -04:00
Wim Taymans 3944687a14 module-protocol-simple: limit to 10 connections
Like in pulseaudio.
2021-06-17 18:37:04 +02:00
Wim Taymans 38c721993f pulse-server: limit the amount of connections
Set to 64, like pulseaudio. We might want to configure this.

See #1305
2021-06-17 18:36:28 +02:00
Wim Taymans 4aa80c7a71 splitter: we always produce output
Always set the HAVE_OUTPUT flag because we always consume the
input and produce output, either to a buffer or an error.
This makes sure processing never stalls when something is wrong
on the output side.

See #1305
2021-06-17 18:34:01 +02:00
Wim Taymans 16755cef52 impl-metadata: fix include 2021-06-17 12:38:53 +02:00
Wim Taymans b167ada994 impl-node: take settings into account for quantum and rate 2021-06-17 11:31:42 +02:00
Wim Taymans c46cb0645e test: fix test
There is now one more global item.
2021-06-17 11:14:20 +02:00