Commit graph

4095 commits

Author SHA1 Message Date
Björn Daase cf38b7bdc4 fix codespell issues 2021-10-07 15:26:18 +00:00
Nicolai Syvertsen dea1755b68 pulse-tunnel: follow pulseaudio for default format 2021-10-07 15:39:11 +02:00
Nicolai Syvertsen 28c2e8ca56 pulse-tunnel: use format, channels and rate props 2021-10-07 13:00:24 +02:00
Peter Hutterer e36183d3cf array: re-initialize the array in pw_array_clear()
Leaving the data nonzero is a use-after-free bug waiting to happen.
2021-10-07 15:08:57 +10:00
Wim Taymans 28744fc5ed work-queue: share one work queue for links and nodes 2021-10-06 19:59:15 +02:00
Pauli Virtanen 49901f2d61 doc: add brief explanations for all groups 2021-10-04 20:55:04 +03:00
Pauli Virtanen 125051a700 doc: reorganize some \pages, and fix some group names
Move \pages having to do with the API usage to the API section.
Better group names for some groups.
2021-10-04 20:39:56 +03:00
Wim Taymans 26c7d48f0a impl-metadata: implement exposed method 2021-10-04 13:49:35 +02:00
Pauli Virtanen c620121529 bluez5: add faststream quirks
For some devices FastStream causes problems. Add quirk for disabling it.
2021-10-03 20:55:02 +03:00
Pauli Virtanen 8159797f89 doc: reorganize Doxygen groups/modules to make more sense
The Doxygen "Modules" page is not very illuminative, as different parts
of the API are mixed together and not all parts are included.

Try to address this:

Put all parts of the public API to some Doxygen group, usually one group
per header file. Use short, systematic names.

Make these groups sub-groups of a few top-level groups, roughly
corresponding to the different logical parts of the API (core, impl,
stream, filter, spa, utilities).
2021-10-03 15:39:27 +03:00
Wim Taymans a95937dfdb log: remove NAME as log prefix, topic is enough 2021-10-03 12:03:45 +02:00
Wim Taymans f275e3baaa jack: add jack log topic 2021-10-03 08:52:27 +02:00
Wim Taymans 786cfc44fb log: add work-queue topic 2021-10-03 08:30:46 +02:00
Wim Taymans d43fdf9f5b log: add mem topic 2021-10-03 07:55:00 +02:00
Wim Taymans 1ba805ac7e log: add stream and filter topics 2021-10-02 14:02:23 +02:00
Wim Taymans 5522e9cb1c log: add loop and mainloop topics 2021-10-02 13:54:22 +02:00
Wim Taymans e1b38e6dd4 impl-link: add link topic 2021-10-02 13:50:08 +02:00
Wim Taymans e9af0e4ef8 log: add topic for data and thread loop 2021-10-02 13:44:50 +02:00
Wim Taymans f0085b383e impl-port: remove NAME prefix 2021-10-02 12:52:42 +02:00
Wim Taymans 9cc34cfe99 buffers: add log topic 2021-10-02 12:46:48 +02:00
Gleb Popov 42d8b2b167 Remove legacy FreeBSD compatibility code 2021-10-01 18:09:44 +03:00
Wim Taymans b418b876e4 media-session: don't try to remap to unpositioned formats
check if a node has AUX channels and mark it as unpositioned in that
case.

If the peer node we need to link to has unpositioned channels, don't try
to configure the node for the unpositioned layout but instead configure
it to its default format and link the ports one by one, as many as there
are.

This is mostly for Pro-audio devices. It does not make sense to
try to remix a stereo stream to 18 channels. Most likely the pro-audio
card does not have 18 speakers connected and we would not known how to
remix anyway because the channels don't have a position. So, just take
the 2 channels and link them to the 2 first AUX inputs, which is usually
more correct and mimics what other players do when outputting to JACK.

If a specific remapping needs to be done for the pro-audio card, it
needs to be configured with a virtual device.
2021-10-01 16:17:24 +02:00
Wim Taymans 0caafffa12 media-session: link AUX nodes as well
Anything can link to an AUX node if nothing else is available, just
like the UNKNOWN and MONO ports.
2021-10-01 16:16:10 +02:00
Wim Taymans 3dde9fef9c client-node: send the right peer_id
Output ports share the same buffers on all mix outputs and the buffers
are stored in a special mix area with id SPA_ID_INVALID.

The special mix area does not have the peer_id of the link, we need to
get that from the non-shared mix area.

This fixes some invalid peer port-id values in the set_mix_info event.
2021-10-01 09:33:19 +02:00
Pauli Virtanen d6509a243d bluez5: fix device.profile setting
Only keys with names starting with "bluez" are passed on to device
settings dict. Rename device.profile to match this.

Also add some debug.
2021-09-30 22:39:34 +03:00
Peter Hutterer 8352e47878 media-session: warn if WirePlumber is running on startup
Matches WirePlumber commit 2bc999594 but here we merely print an error
messages instead of failing to start.
2021-09-30 08:30:55 +00:00
Peter Hutterer 0aa09ec801 media-session: rename mod_topic to ms_topic for clarity 2021-09-30 08:29:06 +00:00
Peter Hutterer bb99f9c71e media-session: exit with status 1, not -1
The EXIT_FAILURE define is 1 and besides, it's more common anyway.
2021-09-30 08:29:06 +00:00
Wim Taymans 5026645e93 pulse-server: add latency_msec parameter 2021-09-30 09:49:09 +02:00
Wim Taymans 696dbf7cd6 pulse-tunnel: pass latency as msec 2021-09-30 09:49:00 +02:00
Peter Hutterer abd5f9fbe8 Remove remaining tabs from meson.build files
No changes, just tab-to-space replacement and a little bit of manual
twiddling.
2021-09-30 00:08:27 +00:00
Wim Taymans d6469e5437 filter-chain: make it possible to suggest a samplerate
Make it possible to let a plugin suggest a samplerate for the filter.
Make the convolver suggest the samplerate of the IR file anf use that
if nothing else is specified in the config.

Fixes #1659
2021-09-29 16:53:18 +02:00
Wim Taymans 275dfed92a filter-chain: handle unaligned sum_simd
Fall back to slow path if the input is not aligned, which can happen
after resampling.

Fixes #1659
2021-09-29 16:30:59 +02:00
Barnabás Pőcze d2f0573369 pipewire: module-zeroconf-discover: handle module destroy events
module-zeroconf-discover loads module-pulse-tunnel for each entity
exposed on the network. Previously, however, the destroy event
of the loaded pulse-tunnel modules were not handled.

This resulted in a use-after-free because both `pw_context_destroy()`
and `module-zeroconf-discover.c:impl_free()` tried to destroy
the pulse-tunnel modules. The reason for that is that since
1de16afc40 the modules
are prepended to the module list of the context, not appended,
therefore modules are destroyed in LIFO order, thus the pulse-tunnel
modules were destroyed before the zeroconf-discover module that
loaded them.

Fix that by handling the destroy event of the loaded pulse-tunnel
modules.

Fixes #1653
2021-09-29 10:35:16 +02:00
Peter Hutterer 4ea8fa8180 systemd: make pipewire-pulse require one of the session managers
Where pipewire and friends are started via socket activation,
a PA client connection to the pulse socket triggers
pipewire-pulse.service. That in turn triggers pipewire.service through
Wants/After and once that is started up, pipewire-pulse actually
starts up.

At the same time, pipewire-media-session or wireplumber are started
through WantedBy/after in the respective service files.

Depending on which leg the race condition got out of bed with today,
pipewire-pulse may be finished before the session manager has set up the
graph and the PA client doesn't see any devices.

Fix this by adding a dependency on the session manager in
pipewire-pulse, installed via an Alias so media-session and wireplumber
can install the same alias. Wants is a light dependency, so for the case
where it doesn't exist we fall back to the current behavior anyway.

This doesn't remove the race condition since systemd may deem the
session manager to have started before the graph is set up, but it
should reduce the occurances.

The disadvantage here: only one Alias will be installed by systemd, so
first-come, first-serve in the case of both media-session and
wireplumber being installed.

See #1553
2021-09-29 07:18:13 +00:00
Peter Hutterer 90cbcb6c05 systemd: add PipeWire to the systemd service file descriptions
Without this, a journal entry merely looks like this:
 Stopping Multimedia Service ...

Which is obviously terrible from a branding perspective but also makes
it harder for users to figure out what process was responsible for this
entry.
2021-09-29 07:17:35 +00:00
Peter Hutterer e3b216c026 media-session: add log topics to all modules
Media-session itself uses ms.core, there are only two files that could
have a sub-topic but right now they don't use it (match-rules and
metadata).

The modules use the ms.mod.* namespace, so it's trivial to filter on
those.
2021-09-28 09:35:39 +02:00
Peter Hutterer 52a96bb602 modules: add log topics to module-protocol-pulse
This ends up using a nested namespace: mod.protocol-pulse for the module
itself, mod.protocol-pulse.foo for the various submodules and
extensions.
2021-09-28 09:35:39 +02:00
Peter Hutterer 96f8a7597e modules: switch protocol-native to the new logging system
This is more complicated than a normal module because we have two
logging topics: mod.protocol-native and conn.protocol-native for wire
messages. Because the latter use spa_debug (through spa_debug_pod) we
need to #define our way around so those too use the right topics.

Note that this removes the previous "connection" category, it is now
"conn.protocol-native" instead.
2021-09-28 09:35:39 +02:00
Peter Hutterer 14112fd168 modules: use the new topic-based logging from various pipewire modules 2021-09-28 09:35:39 +02:00
Peter Hutterer a6e66d9180 pipewire: use the internal log topics 2021-09-28 09:35:38 +02:00
Peter Hutterer 52bd80aaa4 log: add topic loggers and a default topic
pw_log_log/logv now go through the topic-based logger using the
"default" topic. Log topics themselves can be allocated by the call
sites. The simplest way to use a topic from e.g. a module:

    PW_LOG_TOPIC_STATIC(mod_topic, "mod.foo");
    #define PW_LOG_TOPIC_DEFAULT mod_topic
    ...
    void pipewire__module_init() {
  	  PW_LOG_TOPIC_INIT(mod_topic);
  	  ...
    }

With the #define all pw_log_foo() are now routed through the custom
topic. For the cases where the log topic must be specified, a
pw_logt_foo() set of macros is available.

Log topics are enabled through the PIPEWIRE_DEBUG environment variable
which now supports globs, e.g. PIPEWIRE_DEBUG="*:I;mod.access:D"
to enable global INFO but DEBUG for the access module.

Namespaces documented are "pw", "mod" and "conn", for pipewire-internal
stuff, modules and connection dumping. The latter is special-cased to
avoid spamming the log files, it requires an expcit "conn.<glob>"
pattern to enable.

The "default" topic always exists and is the fallback for any
pw_log_foo() invocation that does not use a topic.
2021-09-28 09:35:38 +02:00
Peter Hutterer b58282353b pipewire: pass the PIPEWIRE_DEBUG config down to the logger
Convert the PIPEWIRE_DEBUG environment variable to the json format
specified by the log interface and pass it on.
2021-09-28 09:35:38 +02:00
Peter Hutterer 26cfdc95cc pipewire: use the spa_log_logv macro instead of a direct interface call
This checks the log level of global_log.level again which is always the
same as the global pw_log_level.
2021-09-28 09:35:38 +02:00
Peter Hutterer 264141b31b media-session: add a doc blurb for the restore-stream module 2021-09-28 07:24:41 +00:00
Peter Hutterer 92c7c8354d pipewire: don't log the location if PIPEWIRE_LOG_LINE=false
Default remains enabled, but sometimes it's easier to not have this.
2021-09-28 07:24:23 +00:00
Peter Hutterer bbe9059ed3 pipewire: re-use info dict for the journal logger
All the config options we pass in are standardised in spa/support/log.h, so the
journal logger should be (and it is) able to handle or ignore them.
2021-09-28 07:24:23 +00:00
Peter Hutterer ae59185f6f pw-cli: use readline() in interactive mode
With history and a simple command completion hook this makes the
interactive mode a lot easier to deal with.
2021-09-28 07:19:13 +00:00
Peter Hutterer 7d58ce9e24 pw-cli: add a 'quit' command to exit
Slightly less confusing for new users if we have at least one
help-listed command to exit.
2021-09-28 07:19:13 +00:00
Peter Hutterer 40487e485d daemon: only call pw_log_set_level() if -v is actually given
Previous commit 69e935e unconditionally called pw_log_set_level() after
the option parsing. If pw_init() changed the logging level based on
PIPEWIRE_DEBUG, we'd now overwrite that change.

Call pw_log_set_level() only if -v is actually given on the commandline.
This means a commandline option will override PIPEWIRE_DEBUG if set but
that is intended.

Fixes 69e935e8a4
2021-09-25 07:21:01 +10:00
Peter Hutterer 69e935e8a4 daemon: allow for a -v, -vv, -vvv argument to increase verbosity
Sometimes that's faster than having to play with PIPEWIRE_DEBUG.
Same for pipewire-media-session.
2021-09-24 10:49:42 +00:00
Wim Taymans cb474043fa pulse-tunnel: add pulse.latency option
Add a pulse.latency option to override the default 100ms latency.
2021-09-23 13:11:52 +02:00
Wim Taymans 88ba3014d6 pulse-tunnel: increase default latency to 100ms
20ms is too small and might be a typo from the pulseaudio 200ms default
latency.
2021-09-23 13:00:15 +02:00
Peter Hutterer f06741d6fc media-session: define NAME before including reserve.c
This ensures the log messages show up with the right module name prefix
2021-09-23 15:29:52 +10:00
Peter Hutterer 207c5796b6 pulse: print the strerror on metadata errors 2021-09-23 15:29:48 +10:00
Wim Taymans 884ecab425 add SPA_EXPORT for public functions
Fixes #1638
2021-09-22 15:14:21 +02:00
Wim Taymans 3f032ae464 build: fix session manager path 2021-09-22 09:04:15 +02:00
Peter Hutterer e46a30562f Promote media-session to its own subdirectory
media-session is past the point of being a mere example, let's promote
it out of the subdirectory.

pw-reserve is moved to tools/
2021-09-22 08:53:08 +02:00
Wim Taymans 6f519d4052 pulse-server: put the channel map in the loopback args
Fixes #1486
2021-09-21 18:33:29 +02:00
Wim Taymans c8f629a0a3 pulse-server: improve module args compatibility
Boolean switches can also be true with 'y', 'yes', 't' and 'on'
2021-09-21 17:39:11 +02:00
Wim Taymans d8aec1c7b4 pw-play: move dsdplay into pw-cat 2021-09-21 12:29:41 +02:00
Wim Taymans 0ec77ab09c dsd: show rate in bytes per seconds. 2021-09-21 12:25:42 +02:00
Wim Taymans 23edb9ab2a pipewire: release lock when clearing handle
The handle might want to unload plugins and we thus need to release the
lock.
2021-09-21 10:58:07 +02:00
Wim Taymans 275b8a0f9e dsdplay: make separate dsffile 2021-09-21 10:50:45 +02:00
Wim Taymans fb0c5f503f media-session: DSD is also a valid passthrough format 2021-09-21 10:50:45 +02:00
Wim Taymans ae9f90eccc dsdplay: implement data processing
Simplify channel layout management a little.
Use the bitorder and interleaving to read and format the DSD in the
buffer.
2021-09-21 10:50:45 +02:00
Wim Taymans 43b27002eb tools: add beginnings of DSD player 2021-09-21 10:50:44 +02:00
Wim Taymans 68f4dee2d9 pipewire: use lock for registry and init
Use a global lock to serialize concurrent pw_init calls.
Use a global lock to protect the global registry. With the alsa api,
multiple threads could open the device and create streams and
load/unload plugins.

See !942
2021-09-21 10:31:10 +02:00
Peter Hutterer e8e7e72b76 meson: require alsa for pipewire-alsa or media-session
The previous code had alsa optional if pipewire-alsa was on
auto/disabled bug failed later with missing alsa if media-session was in
the session manager array. Which it is by default.

Fixes #1632
2021-09-21 08:59:30 +10:00
Ivan 1129e90c4f conf: Fix format inconsistencies and beautify configs 2021-09-20 16:40:40 +00:00
Wim Taymans 8efe54a176 media-session: fall back to EnumRoute for availability check
If the device doesn't have an active Route, also check the EnumRoute to
see if there is something available. If nothing is available, also avoid
selecting this node.

Fixes #1624
2021-09-20 18:34:52 +02:00
Wim Taymans 2ae6ac2bcb media-session: skip route availability check for default nodes
For default nodes, that are explicitly configured, skip the route check.
This makes it possible for the user to select a non-available node
as the default still.

Fixes #1624
2021-09-20 18:33:08 +02:00
Wim Taymans 49a0250ecd impl-metadata: avoid infinite loop in cleat_items
When we need to remove all items, copy the storage to a temporary
array and clear the storage.

When one of the callbacks would add a new item to the storage it would
operate on the new empty storage and the loop to iteratively clear
subjects would be able to complete.

Fixes #1622
2021-09-20 15:06:05 +02:00
Wim Taymans afb37dd7fc pipewire: remove useless assignment 2021-09-20 15:05:37 +02:00
Peter Hutterer 335ad734de doc: fix example config for echo cancel
Fixes #1625
2021-09-20 15:56:13 +10:00
Pauli Virtanen 90b4efd98d bluez5: cleanup hfp/hsp backend handling + config file option
It seems not uncommon that people have not properly configured ofono
running, which results to loss of HFP/HSP functionality. It's less
surprising if the backend selection is fixed in the configuration file,
and (by default) does not depend on running services.

Add a configuration file option for selecting HFP/HSP backend, and set
the default value to the native backend. Emit warnings if conflicting
backend services are detected to be running.

Also cleanup hfp/hsp backend handling a bit, now that it's mostly
abstracted behind an interface.
2021-09-19 17:33:32 +00:00
Pauli Virtanen cae1554449 bluez5: move bluez-hardware.conf loading to the plugin
It's not really the responsibility of the session manager to load the
bluez5 device quirks, and it's easier for eg. Wireplumber if it doesn't
need to do it.

Move loading bluez-hardware.conf to be the responsibility of the bluez5
spa plugin, similarly as the alsa plugin deals with the ACP database.

Put the configuration to share/spa-0.2/bluez5, mirroring the plugin
directory structure in lib/spa-0.2/bluez5.
2021-09-19 17:28:17 +00:00
Leonardo Neumann 6168067cb2
fix missing limits.h include 2021-09-18 04:36:20 -03:00
Pauli Virtanen 39c8ed4f62 media-session: don't use-after-free if linking node removed
Should fix an ASAN crash.
2021-09-16 19:20:53 +03:00
Wim Taymans 803763ed01 gst: add 30 seconds timeout
Add a timeout to all blocking wait operations so that we don't wait
forever but error out after 30 seconds.
2021-09-16 10:05:58 +02:00
Wim Taymans a2202de679 gst: also stop waiting when we are flushing 2021-09-15 20:57:10 +02:00
Wim Taymans 077808b09a pipewiresrc: also notify waiters when start fails 2021-09-15 20:57:10 +02:00
Wim Taymans 97be5687ec remote-node: clear the node io areas when removing the memory
When the memory is removed, clear the node io areas so that it doesn't
accidentally get reused.

Fixes a crash in cheese when the node is stopped and then resumed.
2021-09-15 20:57:10 +02:00
Wim Taymans 21657ea2af remote-node: improve node io tag
Set the second tag field to INVALID to separate the node io areas from
the port io areas.
2021-09-15 20:57:10 +02:00
Peter Hutterer 14f0c6f9a6 modules: print the optional modules as part of the meson summary
This makes it easier to figure out if a particular module was missing
from the build. Example output:

  Optional Modules
    rt                        : YES
    rtkit                     : YES
    portal                    : YES
    pulse-tunnel              : YES
    zeroconf-discover         : YES
    roc-sink                  : NO
    roc-source                : NO
2021-09-15 11:24:09 +10:00
Wim Taymans bf29130f84 midifile: debug some more message types 2021-09-14 15:39:35 +02:00
Wim Taymans 36fe2e9b9e context: scale quantum values to default rate
The quantum values are relative to the default clock rate. When an
alternative rate is selected, scale the quantum values accordingly.
2021-09-14 13:34:06 +02:00
Wim Taymans 7543ad0766 impl-node: add node.transport.sync property
When the node support transport sync. That is, when it will clear the
pending_sync flag from its activation area when it completed a new
seek.

Before this patch, the pending sync was always automatically cleared,
which broke some applications that are time masters such as bitwig.

Fixes #1589
2021-09-14 11:06:19 +02:00
Wim Taymans 47a46e198f improve debug 2021-09-14 11:06:19 +02:00
Wim Taymans fda6e7b4af pulse-server: parse default.clock.rate from core info
Use the core.info clock rate as the default sample rate as soon as the
manager exposes the core object. Otherwise the default sample rate is 0
until someone calls GET_SERVER_INFO, which as a side effect sets the
default sample rate.

Fixes issues with sinks not appearing right away.

Fixes #1588
2021-09-13 10:50:01 +02:00
liberodark d2017ff540 Fix multiple module dir 2021-09-11 14:29:48 +00:00
Davide Beatrici fc9f7c1005 stream: declare pw_stream_get_control() in header
The function is defined and exported, but is not declared in the header.
2021-09-11 14:28:35 +00:00
Pauli Virtanen 966fbd5a21 bluez5: blocklist devices for sbc-xq 2021-09-10 17:57:21 +00:00
Wim Taymans 9faa006c1d media-session: try to not select nodes with unavailable route
Nodes that have the current route as unavailable should preferably not
be selected as defaults or targets.
2021-09-10 13:38:29 +02:00
Peter Hutterer e1672f9762 pipewire: allow for log level names in PIPEWIRE_DEBUG
Allow one of "XEWIDT" to refer to none, errors, warnings, info, debug
and trace, respectively because they're immediately recognizable. Well,
except maybe the X.

PIPEWIRE_DEBUG="I" is equivalent to PIPEWIRE_DEBUG="3" for example.
2021-09-10 07:38:20 +00:00
Pauli Virtanen 3f8fb6e4dc media-session: don't bluez-autoswitch for suspended/idle/errored streams
E.g. skypeforlinux makes its input streams idle but does not destroy
them, when no call is active.
2021-09-10 07:35:12 +00:00
Pauli Virtanen 4f8ff41a45 media-session: don't crash if obj->info is missing 2021-09-10 07:35:12 +00:00
Wim Taymans e6d7b1aa70 media-session: copy some device keys to the nodes
Chrome seems to want to use the device.bus
2021-09-09 18:05:20 +02:00
Wim Taymans 67be26aac7 media-session: only check passthrough when available
When none of the nodes have a valid passthrough format, don't check if
passthrough is possible.

Without the check, it is possible that a node has a common format with
the peer that is not a passthrough format, like a raw audio format.

Fixes #1587
2021-09-09 16:24:04 +02:00
Wim Taymans e4b030fafa jack: add option to disable process lock
Some applications might expect the process function to run concurrently
with the callbacks. PipeWire tries to avoid this by using a lock for the
duration of the process callback. Make an option to disable this.

See #1576
2021-09-08 13:02:04 +02:00
Wim Taymans 2071a14c82 context: only apply lock-quantum for unsuspended nodes
When the node is suspended, don't take into account the lock-quantum
settings or else the graph would not want to change to the requested
quantum of the node.

Say we have a jack node with node.lock-quantum = true and
node.latency=256/48000. When it joins the graph and is suspended, the
lock-quantum is ignored and the node.latency is set on the graph.
After that, the lock-quantum ensures the graph quantum doesn't change
anymore until the node is suspended.
2021-09-08 11:53:08 +02:00
Wim Taymans 9423e8d648 impl-node: move quantum and rate
When we move a node from one driver to another, move the quantum and
rate if the target driver was idle so that we can mostly continue
uninterupted until a quantum/rate change is calculated.
2021-09-08 11:51:09 +02:00
Wim Taymans a3fe226eac context: don't try to change the quantum when idle
When the driver is going to be idle or not running, avoid updating
the quantum.

This is mostly when a node is moved to another driver. Changing the
quantum of the old driver would have the clients briefly see the useless
quantum before being moved to the new driver.
2021-09-08 11:28:05 +02:00
Peter Hutterer 055643091f meson: drop default-session-manager, use the first session-manager instead
default-session-manager is only used in the pw-uninstalled.sh developer
script. c25cec230c added the ability to
use the system-installed wireplumber but other than that this option is
largely superfluous.

Drop it and pick whichever the first entry to session-manager is. For
the vast use-case of either MS or WP this will just work fine and for
the niche case of building both SMs one just needs to make sure the
order is as desired.

And in the case of no session manager, the config line to start the SM
is now commented out.
2021-09-08 07:50:48 +00:00
Peter Hutterer 71ee6ec669 daemon: split the session-manager and pipewire-pulse comments
Let them be enabled/disabled individually.
2021-09-08 07:50:48 +00:00
Peter Hutterer bc2d820b6d meson: make media_session_sources unconditional
The sources are used by the documentation, so rather than duplicating
the checks for whether to build it or not, just define it as
always-present empty array and fill it when needed.

Otherwise we get a meson error if media-session is disabled but
documentation is enabled.
2021-09-08 07:44:48 +00:00
Peter Hutterer 852d6fc4b6 media-session: remove a superfluous NULL check
spa_streq() checks for NULL and (through the same function) so does
pw_properties_parse_bool()
2021-09-08 07:44:48 +00:00
Wim Taymans 75f15accd5 filter-chain: add dirac pulse 2021-09-07 20:12:58 +02:00
Peter Hutterer c25cec230c meson: if WP is the default SM but not built, use the system one
If we're not building wireplumber but it is set as the default session
manager, search for one in $PATH and use that.
2021-09-07 14:09:35 +00:00
Peter Hutterer 05759e3bab meson: use 'auto' as default session manager
Right now, meson -Dsession-managers=wireplumber will fail the build
because the default session manager option is set to media-session - and
if that isn't being built we error out.

Use an 'auto' value instead, selecting the first session-manager in the
list as the default one.
2021-09-07 14:09:35 +00:00
Peter Hutterer 86362407c1 meson: improve an error message
We have -Dsession-managers and -Ddefault-session-manager, the latter is
currently only used for pw-uninstalled.sh. Let's adjust the error
message to use "default" so it's a bit easier to understand by this may
fail with -Dsession-managers=wireplumber.
2021-09-07 14:09:35 +00:00
Peter Hutterer 902444ae1a meson: if media-session is to be built but alsa is missing, error out
If -Dsession-managers includes media-session, we should error out if the
dependency is missing instead of just silently skipping the build.
2021-09-07 14:09:35 +00:00
Wim Taymans f0bc0d068e link: avoid multiple concurrent negotiations
When multiple links are created at the same time for the same port, we
get into a race where multiple links will try to set a format
asynchronously and eventually break the links. Avoid this by marking the
port as busy for as long as an async format or buffer is pending and
avoid starting new link negotiation when one of the ports is busy.

This problem was observed when ardour6 tries to link all device capture
ports to its single monitor port.
2021-09-07 15:48:44 +02:00
Wim Taymans 882f1aee6c media-session: turn some info in debug 2021-09-07 09:56:50 +02:00
Peter Hutterer 2306124f49 doc: fix listing of the new No DSP media-session module
And copy the text from the comment into the public documentation, better
than just having an empty page there.
2021-09-07 07:52:45 +00:00
Wim Taymans 7e4d5b142f pulse-server: don't leak format info 2021-09-07 09:51:58 +02:00
Peter Hutterer 8bb0e340c7 protocol-pulse: fix two -Wformat-nonliteral warnings
For the stream group, we break into the three components we write out
and print those.

For the IPv6 address printing inside [], we can make this a condition on
the printf statement.
2021-09-07 08:57:28 +10:00
Peter Hutterer 6a18272fed spa: mark the gettext wrappers with __attribute__((format_arg))
This removes the -Wformat-literal warnings for all _("some message")
calls. Remaining warnings are those where we pass in a custom buffer.
2021-09-07 08:26:10 +10:00
Pauli Virtanen b5ad37c7ac bluez5: make codec loading compatible with old conf files
Change codec factory names to api.codec.bluez5.*, so that they won't
conflict with old config file lib name rules for api.bluez5.*

Specify the fallback library name when loading the codecs, so that it
works without the rules in config files.
2021-09-06 18:04:35 +03:00
Wim Taymans 435de99428 Increase pod buffer size
The props of a 64 channel node are at least 2048 bytes long so make sure
we can build and filter them.

Fixes #1574
2021-09-06 15:09:28 +02:00
Peter Hutterer 8d741d6077 alsa-monitor: document this module in some detail 2021-09-06 07:29:28 +00:00
Peter Hutterer 7cb718833b alsa-monitor: reword the match rule comment in the config file
Each dictionary needs to fully match but out of the dicts we have, only
one needs to match to apply. Reword that for clarity.

Also document regex vs normal string comparison vs the magic null
string.
2021-09-06 07:29:28 +00:00
Peter Hutterer 6f9586bf54 media-session: use more descriptive names for parsing match rules
Easier to understand this way what is being passed around and where
we're at with the parsing.
2021-09-06 07:29:28 +00:00
Peter Hutterer 6b6f5f3659 doc: mention xdg-desktop-portal in the media-session access-portal module
Makes it slightly easier to connect the dots.
2021-09-06 07:29:28 +00:00
Peter Hutterer 55f01ae679 media-session: document the access-flatpak module 2021-09-06 07:29:28 +00:00
Peter Hutterer 08be841a9e doc: fix a doxygen undocumented parameter warning 2021-09-06 07:29:28 +00:00
Pauli Virtanen abc01083d4 context: fixup integer overflow 2021-09-05 06:26:58 +00:00
Pauli Virtanen f85d3907ef bluez5: add a device to hw-volume blocklist 2021-09-03 19:09:16 +00:00
Pauli Virtanen 68e8846096 bluez5: update kernel version blocklist
Patch fixing ALT1 mSBC is in Linux 5.10.62, 5.13.14, 5.14.1, 5.15-rc
2021-09-03 19:09:16 +00:00
Pauli Virtanen 59d572de09 bluez5: split A2DP codecs to separate SPA plugins
Make easier to package A2DP codecs separately, by splitting each to a
separate SPA plugin.  Adjust the code to not use a global variable for
the codec list.

The A2DP SPA interface API is in the bluez5 private headers, and not
exposed in installed SPA headers, as it's too close to the
implementation.
2021-09-03 20:40:30 +03:00
Pauli Virtanen 3115775c02 context: add SPA plugin loader interface to support plugins 2021-09-03 20:12:28 +03:00
Julian Bouzas 90371440b0 media-session: add alsa-no-dsp module
Instruct the policy to not configure audio adapter nodes in DSP mode. Instead,
Device nodes will always be configured in passthrough mode, and client nodes
will be configured in convert or passthrough mode depending on whether the
client format matches the device format or not.
2021-09-03 14:00:27 +00:00
Wim Taymans 91f1b44499 introspect: improve info updates
The current _info_update() methods will always reset the change_mask in
the new info structure.

This causes problems if multiple updates are applied to the info before
the rescan in the session manager of pulse-server is excuted. The first
update is cleared and this causes the session manager to sometimes miss
the state changes of nodes and fail to suspend them.

Add a new method to merge with optional reset of the various
introspection info structures. We can use this instead and simply
accumulate all changes until the rescan code has processed all changes.
2021-09-03 13:41:14 +02:00
Wim Taymans a5e37540ff impl-node: recalc graph when destroying a node with driver
When we destroy a node that still has another driver, recalculate the
graph so that the driver has a chance to idle.

This can happen when we add an inactive node to the driver and then
destroy the node, like for jack clients.
2021-09-03 11:12:51 +02:00
Wim Taymans 5fa1ae99ae media-session: implement passthrough for S/PDIF
Make sure we always suspend before reconfiguring a device.

Put the node and the device in passthrough mode when requested. Move
back to DSP mode after the node is unlinked.

Parse the exclusive flag of a stream once when the node info changes.

Use a new variable 'passthrough' to remember the current state of
a node and the peer.

Parse non-raw formats as well.

Check if two nodes can passthrough by intersecting the EnumFormat
params. If it is possible, configure the node for passthrough.

Don't try to reconnect nodes in passthrough.

Fail if we can't find a node compatible with passthrough.

See #629
2021-09-02 16:12:03 +02:00
Wim Taymans ef795cc2e3 pulse-server: add quirk for skypeforlinux
Or else it refuses to show the output devices in some cases for some
reason.
2021-09-02 15:22:27 +02:00
Wim Taymans 9052b1be33 media-session: add option to restore bluetooth profile
Add default-profile.restore-bluetooth option to restore the BT
profile.

See #1567
2021-09-02 11:39:17 +02:00
Wim Taymans f277487887 media-session: save and restore IEC958 Codecs 2021-09-02 10:27:59 +02:00
Wim Taymans 80628f38e7 alsa: move codec config to acp-device
Just like the latency, move the codecs to the device Route param.
This way, it is easier for the session manager to save and restore
the codecs as part of the Route settings.
2021-09-02 10:27:59 +02:00
Julian Bouzas 1a93165e84 impl-port: use audiomixer for RAW media subtype when setting up mixer 2021-09-01 17:35:47 -04:00
Jonas Holmberg 28cf342bb8 media-session: Change some warnings to info
If a program using pipewire-alsa calls snd_pcm_close() immediately after
snd_pcm_prepare() without reading or writing any data the client node
may be removed before the session manager can link it, which would
result in the following log warnings:

can't link 35:40 -> 43:48: link-factory: unknown input port 48
error id:25 seq:11467 res:-22 (Invalid argument): link-factory: unknown input port 48
can't link 35:41 -> 43:46: link-factory: unknown input port 46
error id:16 seq:11468 res:-22 (Invalid argument): link-factory: unknown input port 46
2021-09-01 15:15:51 +00:00
Wim Taymans eafef40430 pulse-server: remove pod debug 2021-09-01 13:25:52 +02:00
Wim Taymans ea7a731106 pulse-server: set the SINK_SET_FORMATS flag
When we have an iec958Codecs property on the node, we can use it to
configure the codecs on the sink.
2021-09-01 13:24:50 +02:00
Wim Taymans 49eb31f670 pulse-server: add device-restore extension
This is mostly to read and set the supported formats of a sink.
2021-09-01 13:23:10 +02:00
Wim Taymans a25396c1eb pulse-server: filter out iec958 PCM formats
Convert the iec958 PCM formats differently when enumerating the sink
formats. This way we can still convert the param to a format_info.
2021-09-01 13:23:05 +02:00
Wim Taymans 592163fb0a stream: rename a variable 2021-08-31 16:04:34 +02:00
Wim Taymans e7a43f6d91 filter-chain: add 7.1 virtual sink example 2021-08-31 13:52:52 +02:00
Wim Taymans dce6f30954 filter-chain: rename sink-convolver
Rename to what it actually does.
2021-08-31 13:46:36 +02:00
Wim Taymans 3300f5ddc4 context: activate loopback to drivers
We start with setting the visitied flag on the driver. Still follow the
links to other visited nodes because it might make them active. for
example, adding a link between two midi ports should make the midi
driver running so that data flows between the ports.

See #1559
2021-08-31 11:45:14 +02:00
Konstantin Kharlamov a4f3a23095 tools/pw-dump: add support for --color-always 2021-08-31 08:42:15 +00:00
Konstantin Kharlamov e7db65b133 media-session: remove unused props from struct profile 2021-08-31 08:42:15 +00:00
Wim Taymans d34c4facc0 module-roc: fix properties
Actually set the right properties on the source and sink.

Not quite right because the pulseaudio ROC has a sink-input or a
playback stream in pipewire.

See #1538
2021-08-30 23:27:51 +02:00
Wim Taymans 9f57341699 module-pulse-tunnel: set the bufferattr right
tlength for playack and fragsize for capture.

See #1434
2021-08-30 21:26:33 +02:00
Wim Taymans cff9dbf9dd echo-cancel: improve properties
Make the streams passive so that things can suspend.
Use a differend node.name for the input and output streams so that
autoconnect can actually remember the right target.
Make the media.name and description nicer.

See #1557
2021-08-30 10:50:03 +02:00
Julian Bouzas d4b06431ff pulse-server: calculate buffer size based on the frame size
Audio with big frame sizes (especially audio with multiple channels) needs more
buffer size than the one calculated with the current formula. This patch uses
the frame size to calculate the buffer size, fixing playback issues for clients
configured in passthrough mode.
2021-08-30 08:01:52 +00:00
Julian Bouzas b136bb8ca5 pipewire-pulse: delay create stream reply if the peer is not found
When the client adapter is configured in passthrough mode, the stream param
changed event in pipewire-pulse is emitted before the session manager creates
the link, and not after. Therfore, the peer can never be found when replying
create stream, and the pulseaudio application receives a stream error.

This patch delays the create stream reply until the link is added if the peer
cannot be found, fixing the above race conditon to allow passthrough mode to
work with pulseaudio applications.
2021-08-30 08:01:52 +00:00
Konstantin Kharlamov 60480f422e media-session: simplify save_profile 2021-08-30 01:12:14 +03:00
Konstantin Kharlamov 2c7cdcfa41 media-session: constify various params 2021-08-30 01:12:09 +03:00
Wim Taymans e90c436f3a filter-chain: remove another copy 2021-08-27 21:05:32 +02:00
Wim Taymans 4677cc348c stream: clear the draining/drained state when inactive
When we inactivate the stream, clear the draining/drained state.
Otherwise, the stream stays in the drained state and won't call the
process function anymore when we activate it again.

This used to work before because we called the process function from the
Start command, which would queue a buffer and unset the drained flag.
Calling the process function from Start was however not right when the
process function needed to be called from the RT thread or when the
stream is a driver.

Fixes the issue where speaker-test would only play one channel.
2021-08-27 17:12:03 +02:00
Wim Taymans 994630cb3a filter-chain: optimize convolver some more
Add function to convolve without accumulate and use that when possible
to avoid some memset and memcpy.
2021-08-27 17:11:45 +02:00
Wim Taymans 73854e9ec9 filter-chain: improve convolver
Make the input buffer a little larger and leave the top blockSize
samples zero. That way we can fill up the lower part, leave the upper
part zero padded and feed this to the fft directly. Also only clear
the lower part when we can't fill it completely.

This removes some memcpy and memset operations.
2021-08-26 17:19:48 +02:00
Julian Bouzas 34b1ecc244 pw-cat: calculate number of samples properly with io_rate_match
Fixes wrong buffer sizes when adapter is configured in passthrough mode.
2021-08-25 19:23:23 +00:00
Wim Taymans a701a500af filter-chain: add hilbert function
Can be used to perform a 90 degree phase shift.
2021-08-25 21:20:42 +02:00
Wim Taymans 09a0fdcc0f protocol-simple: avoid freeing client multiple times
Ensure we only queue one cleanup operation and cancel all pending
operations when we destroy the client.

Fixes #1550
2021-08-25 21:19:25 +02:00
jakobrs d1f521af40 Add missing > in link factory usage string 2021-08-25 15:39:06 +00:00
Wim Taymans a9169cf491 pulse-server: Handle formats of virtual devices better
Virtual devices tend to start with partial fields set in the EnumFormat
param (usually rate is missing). This causes virtual devices to be
invisible until they are used in some way.

Fix this by relaxing the parsing of EnumFormat and by falling back to
the server defaults for the unspecified fields.

Fixes #1413
2021-08-25 17:33:22 +02:00
Wim Taymans 3526e33fe1 impl-node: send Pause when a Play reply is pending
When we send a Play request to the client but it deactivates before
sending the reply, make sure we send a Pause request as well so that
Play/Pause is always matched up.

Fixes #1548
2021-08-25 16:29:59 +02:00
Wim Taymans 67965d60be stream: fix debug message 2021-08-25 13:08:49 +02:00
Wim Taymans 11cb77c577 context: fall back to default rate in case of errors
When the allowed rates does not contain the default rate, also
fall back to only the default rate.
See the configured rates in the properties so it can be inspected.
2021-08-25 09:28:23 +02:00
Wim Taymans df92c09ff5 filter-chain: fix loop index 2021-08-24 16:45:11 +02:00
Wim Taymans 1e4e83d305 filter-chain: add more mixer ports
Add option to set NULL data as the port data so that plugins can
skip processing.
Add 8 mixer ports and skip NULL data.
Move silence and discard samples to static area.
Improve the virtual sink examples. use the correct mixing for the HRIR
channels.
2021-08-24 16:26:06 +02:00
Wim Taymans 123fe3d1c5 filter-chain: improve pffft compilation and CPU support
Compile different pffft versions per CPU.
Plug the right version depending on the runtime CPU.

See #1543
2021-08-24 12:07:37 +02:00
Wim Taymans 0f5face73f filter-chain: use pffft for the convolver
It is faster.
2021-08-23 21:00:45 +02:00
Wim Taymans 34e53113e2 pulse-server: handle the case where rate-match returns 0
Still feed the minreq amount of data into the converter.
2021-08-23 17:27:45 +02:00
Wim Taymans 454a9bd55f media-session: detect passthrough and passthrough only nodes 2021-08-23 13:28:02 +02:00
Wim Taymans 44d575ba70 stream: enable adapter for all audio streams
This way, we can support streams with normal and passthrough
formats by switching the adapter mode.
2021-08-23 13:06:06 +02:00
Wim Taymans 10c3bf5ff3 media-session: detect and block passthrough-only streams
If we see that the stream only has passthrough formats, make them
error immediately for now.
2021-08-23 13:03:50 +02:00
Wim Taymans 1a713e963a pulse-server: fix parsing and creation of iec958 formats
Implement creating IEC958 format EnumFormat params.

Fix parsing of negotiated IEC958 formats and convert to our internal
format.
2021-08-23 12:09:53 +02:00
Wim Taymans bceb9a4b6e pipewire-pulse: enumerate iec958 formats for sinks 2021-08-23 11:58:29 +02:00
Wim Taymans 9dfe35b17c alsa: add enumeration of iec958 format
For hdmi and iec958 devices, enumerate the iec958 formats and
codecs. Initially only PCM is supported as a codec but with
a property or an init option, the list of codecs can be dynamically
configured.
2021-08-23 11:31:52 +02:00
Wim Taymans 24f61deefd media-session: also check restore-stream when info updates
We only need an info update to restore the stream so check for that
in addition to a param update.

The info update can be used to restore the stream and the param update
to update the stored value.
2021-08-23 10:58:29 +02:00
Pauli Virtanen 7362a6be04 bluez5: update mSBC kernel version blocklist
Also versions 5.10.y, y >= 51 contain patch that removes ALT 1 support,
and fix has not reached stable yet.
2021-08-23 08:21:44 +00:00
Pauli Virtanen 82fc54f252 media-session: bluez-autoswitch: save user-selected headset profile
When switching back from the recording mode, save currently selected
profile as the default headset profile to use in future.

This allows users to select a specific profile they want to use for
input, and to avoid autoswitching to HFP/HSP if they want to use a
different microphone, without needing to edit configuration files.
2021-08-23 08:21:13 +00:00
Pauli Virtanen e08cdf27d5 bluez5: add FastStream codec
A2DP codec that uses SBC.  Has a duplex channel, which sends an SBC
stream back.
2021-08-23 08:17:46 +00:00
Pauli Virtanen dedc08cdf8 bluez5: enable duplex for aptx-ll
aptX-LL sink devices may send back mSBC encoded data corresponding to
microphone input.  It appears to be enabled when the bidirectional link
is set in the caps, and the device also supports this.

Implement mSBC decoding in the duplex channel.

Tested to be working on Avantree Aria Pro.
2021-08-22 17:41:50 +03:00
Wim Taymans 4ab8ecfe06 pipewire: allow : in SPA_PLUGIN_DIR to scan multiple paths 2021-08-20 10:15:21 +02:00
Wim Taymans abf37f618e modules: ensure node.name and description are set
Most apps need this and some even crash when they are not set.
2021-08-20 09:26:17 +02:00
Stefan Riesenberger bb2f637839 pipewire-pulse: set description for ladspa sources 2021-08-19 17:33:31 +02:00
Pauli Virtanen 90b62ba2b3 bluez5: add aptx-LL codec
Support the low-latency variant of the aptx codec.

The magic mostly seems to be on the device side, since the stream is the
same as standard aptx, but latency is smaller even if stream/packet
sizes are the same.

Sound output latency is noticeably less than with the standard aptx.
Tested on Sennheiser HD 250 / Avantree Aria Pro.

The codec in principle also supports bidirectional duplex streams,
but that is not implemented here.
2021-08-18 19:55:22 +00:00
Wim Taymans f96fa1bf36 pulse-server: find the rate in the format_info
Also look for the highest rate in the format_info to suggest as
the graph sample rate.

See #1523
2021-08-18 16:58:22 +02:00
Wim Taymans f8aa4dcfcc context: only prepared nodes can make a node non-passive
This avoid starting the node before the link has been prepared.
2021-08-18 16:20:24 +02:00
Wim Taymans 2d4ded2384 conf: waitpid needs a cleared status
It might not change the status when the process has changed state.
2021-08-18 09:45:15 +02:00
Wim Taymans 0bad741d45 pw-cat: suggest samplerate as graph rate 2021-08-18 09:44:53 +02:00
Wim Taymans c25e6cee50 pulse-server: add an example of context.exec in the config file
Extra setup with pactl or scripts can be run here.
2021-08-17 20:31:47 +02:00
Wim Taymans bf66a3b236 pulse-server: use NODE_RATE to suggest a graph rate
When the rate is in the allowed rates and the graph is idle, it
will switch to the new rate.
2021-08-17 20:05:19 +02:00
Wim Taymans 49c1c0386f pw-cat: fix raw read
raw read needs bytes, so use the stride to calculate it from frames.
Move ulaw/alaw to packed formats.
2021-08-17 17:56:31 +02:00
Wim Taymans f7c91491cb pw-cat: support ulaw/alaw formats 2021-08-17 17:35:31 +02:00
Wim Taymans 961f478af8 pulse-server: add alaw/ulaw support 2021-08-17 17:35:05 +02:00
Wim Taymans c3db68a219 gst: support ulaw/alaw conversion of caps 2021-08-17 17:34:14 +02:00
Wim Taymans 5a05ee8753 media-session: fix defaults for internal latency 2021-08-17 10:28:28 +02:00
Wim Taymans a2083d12d4 alsa: add params to set default internal latency 2021-08-17 10:15:40 +02:00
Wim Taymans ee6d363481 filter-chain: add the 2 stage convolver
So that the tail is processed with a larger fft size to make it
faster for larger convolutions.
2021-08-16 20:31:43 +02:00
Arun Raghavan ffb7893f20 doc: Fix minor copy-pasto in impl-module 2021-08-15 17:09:02 +02:00
Pauli Virtanen 5071589aea bluez5: enable SBC-XQ codec by default, if allowed by quirks
Enable SBC-XQ by default, and move it at the end of the codecs list, so
that bluez does not connect to it automatically except when it is the
codec used previously.

When the codec is disabled by quirks, it won't appear in the codecs
list, and so can't be selected by user (and so won't be connected
automatically).

However, since SelectConfiguration does not carry information which
device is in question, we cannot prevent BlueZ connecting to the codec
even if it's disabled for a specific device. If the "impossible" occurs
regardless, we won't reject the connection and the profile will be shown
as the generic "A2DP" one.  If the sound is garbled, the user can select
some other profile that works.
2021-08-13 18:45:16 +00:00
Torkel Niklasson eff67c3c03 Add log level argument to ratelimit_test function
If a log message is rate limited, we only need to know about it if we
are actually interested in that log level. We therefore add an argument
to the ratelimit_test function to set the log level of the message
printed if a message is skipped

Change-Id: I5ccd4a78bf7e972fe8b0e7133cd7e08c1e38835f
2021-08-12 18:59:31 +00:00
Wim Taymans f816f702a5 filter-chain: make sndfile optional
Replace the code paths that require sndfile with a fallback when the
dependency was not found.
2021-08-12 09:59:56 +02:00
Wim Taymans ce2b385318 filter-chain: protect against bad values 2021-08-11 21:33:56 +02:00
Wim Taymans 755eab0cd3 filter-chain: add more convolver options
Add gain, delay, offset, length, channels options.
Make default blocksize depend on the ir length.
2021-08-11 21:33:56 +02:00
Wim Taymans dbe9f02471 filter-chain: add support to read from offset
So that the channel of the response file can be set
2021-08-11 21:33:56 +02:00
Wim Taymans be9ac91ce1 filter-chain: read samples correctly 2021-08-11 21:33:56 +02:00
Wim Taymans 44c6ec146e filter-chain: parse config options
Remove LADSPA dependencies, only use it in ladspa_plugin.c
Parse convolver config, like filename
2021-08-11 21:33:48 +02:00
Wim Taymans a2aaa71392 filter-chain: simplify plugin API some more 2021-08-11 21:12:38 +02:00
Wim Taymans 48136b4c2b filter-chain: simplify the plugin API 2021-08-11 21:12:38 +02:00
Wim Taymans 85dd03c2d8 filter-chain: make plugin wrapper
So that we can implement the internal plugins with a more expressive
API than LADSPA.
2021-08-11 21:12:36 +02:00
Wim Taymans e46799d43f filter-chain: simplify parsing a little
Always parse the value and check the type.
2021-08-11 21:10:29 +02:00
Wim Taymans 67eb485811 filter-chain: add convolver 2021-08-11 20:54:04 +02:00
jicksaw b4976728c3 filter-chain: fix parsing when control isn't last
Control had to be defined last, because after it the parser would
start skipping keys and fail to set rest of the params.
2021-08-11 18:52:10 +00:00
Pauli Virtanen aa0736d67f pulse-server: allow moving nodes with node.target to default sink/src
Set node.target metadata to "-1" instead of deleting it to direct nodes
to the default device.

Deleting the metadata, as done previously, does not work for nodes for
which the client has node.target set.
2021-08-09 22:25:59 +03:00
Pauli Virtanen 8c6b111ea6 media-session: simplify target node handling + fix priorities
Handle all node.target behavior in rescan_node.

Make distinction between target nodes set in session manager via
metadata or via restore-stream; priorities are
metadata > client's node.target > restore-stream.
Allow metadata override to also remove the target node setting.
2021-08-09 21:02:43 +03:00
Pauli Virtanen e2d810a9b9 media-session: fix linking nodes with targets to wrong nodes
For nodes that have node.target set, when the target is not available,
media-session links them to any available node.  If the target node
appears afterward, media-session would not re-link them, leading to
output being directed to wrong place (e.g. pavucontrol input monitor)
even though the intended target or a better fallback is available.

This occurs e.g. when devices are removed and re-added.

Fix this by (i) for reconnectable nodes, reconnect them if target
appears later, and (ii) for non-reconnectable nodes, raise error to the
client if node.target is set but not found (but proceed to fallback if
obj->target_node is set).

Also slightly reorganize policy-node.c:rescan_node for clarity.
2021-08-09 21:02:43 +03:00
Wim Taymans 5a4ef78480 pulse-server: fix some indent errors 2021-08-09 15:27:42 +02:00
Wim Taymans 0e386b6584 context: also set driver on inactive nodes that want one
Also set the driver on an inactive node when it wants a driver.

Fixes the case where xjadeo does not activate itself but still wants
to poll the transport state of the driver.

See #1491
2021-08-09 10:50:07 +02:00
Wim Taymans 7fda66142b conf: try to load state from where we saved it
When XDG_STATE_HOME is unset, we save in $HOME/.local/state/pipewire,
so try to first load the state file from there as well before we
try to fall back to the old XDG_CONFIG_HOME location.
2021-08-09 09:47:58 +02:00
Peter Hutterer 55c264d2a5 conf: store state in XDG_STATE_HOME
Defaulting to $HOME/.local/state, this is the directory that state
information is to be kept.

As with the configuration loading, where a caller requests an absolute
path, that path will be honored, we only fall back to XDG_STATE_HOME for
relative paths.

This adds a new PIPEWIRE_STATE_DIR environment variable to override this
directory.
2021-08-09 16:52:43 +10:00
Peter Hutterer 956c83f1c8 conf: rework conf_load to take a path only
Refacturing to make it possible to read from different paths.
2021-08-09 16:48:50 +10:00
Pauli Virtanen 83f72489ad media-session: if no node found on reconnect, unlink but no error
If a reconnecting node was linked at least once successfully, and a
re-link ends up not finding any node to link to, don't raise an error.
Instead, just unlink the node, and wait for a suitable sink to appear
later.

This fixes the issue that some Pulseaudio apps have to be restarted
if all devices go away, before they start working.

It also seems like the right thing to do, because if you remove links
manually, this does not cause errors to occur.
2021-08-08 19:22:45 +00:00
Nils Tonnätt dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Barnabás Pőcze 090aaa4fb0 media-session: bluez-autoswitch: simplify logic
When `val` was used, it was always a true-ish since the
address of an array on the stack was assigned to it.
Remove this variable altogether, and use `name` directly.
Only use `name` when it is valid - when `key && value`.
2021-08-08 18:46:53 +02:00
Barnabás Pőcze 3724088c21 media-session: bluez-autoswitch: fix memory leak
`impl->default_sink` is dynamically allocated, but previously
it was not freed when the containing struct was being destroyed.
Fix that by freeing it in `session_destroy()`.
2021-08-08 18:46:53 +02:00
Pauli Virtanen 4840fd3da8 media-session: don't remove default.configured when devices go away
There's no particular problem to have default.configured to point to a
non-existent device, it will be ignored.  This was left over when
default and configured default were made separate things.

default-nodes also doesn't need to track the id of the configured
default, so remove also other stuff that's no longer necessary.  It can
simply load the values to metadata on startup, and save them to a file
when they are changed, without needing to understand what the values
mean.

Also fixes commit 7071562334 causing defaults to be forgotten when
nodes are removed.
2021-08-08 14:28:46 +03:00
Wim Taymans 33d8f14e45 stream: don't call process() in Start in some cases
We only want to call process() from Start when we are not a driver and
not realtime.

When we are a driver, the user will need to call _trigger_process()
to kick things of.

When we are asked to schedule process from the realtime thread, we
need to wait until the RT thread is scheduled.

In all other cases we can call _process() from the mainloop so that
the RT thread has something to collect when it gets scheduled.
2021-08-06 16:15:55 +02:00
Wim Taymans b030a4e7da stream: add a method to check if driving or not
When the node is driving, we need to call trigger_process()
otherwise we don't and we simply need to wait for the process() to
be called, triggered by the driver node.

See #1484
2021-08-06 15:36:52 +02:00
Wim Taymans 3c97090ba0 stream: rename _drive() to _trigger_process()
Should be a bit more intuitive to understand what it will do.
2021-08-06 15:32:21 +02:00
Wim Taymans 47fe5b550d examples: add a pull based video player
It has the DRIVER flag set and sets a PW_KEY_PRIORITY_DRIVER value
to something higher than the source so that it becomes the driver.
Every timeout it does pw_stream_drive() to start the graph, which
will eventually call the process function with a pulled buffer to
display.

The framerate is set to something lower (80ms between frames) to
show the pull effect.

fixes #1484
2021-08-06 14:49:32 +02:00
Wim Taymans 23d3b10be4 examples: update video-src examples
So that hey use pw_stream_drive() to start the graph.
2021-08-06 13:55:43 +02:00
Wim Taymans 9831f62927 stream: add pw_stream_drive()
This method is meant for driver streams when they have data or need
data.

Previously only source (output) streams could drive the graph and
indirectly by doing pw_stream_queue_buffer(). This behaviour is now
deprecated (but will still work) in favour of calling
pw_stream_drive() explicitly.

pw_stream_drive() will call the process function immediately (if
driver) or later (when not a driver) so that the same code paths
can be used when running as a driver or not.

In a similar way, a consumer (input) driver stream can now be
written. It will call pw_stream_drive() when it wants data and the
process function will be called when the data is ready.

See #1484
2021-08-06 13:36:34 +02:00
Wim Taymans 42e0b520aa stream: Detect if we are driving or not
We need to check the position vs the clock to see if we are currently
driving the graph. We can only call the node ready callback when
we are actually driving the graph.
2021-08-06 13:09:39 +02:00
Peter Hutterer 5da2081a4b default-profile: document what this module does in more detail 2021-08-06 08:03:27 +00:00
Peter Hutterer 43a560e25f default-profile: make the job to restore a saved profile easier to read
"restored" describes a state but the only case we actually set this
value if we want to restore our previously saved profile. Rename a
variable to indicate this, makes it easier to understand.
2021-08-06 08:03:27 +00:00
Peter Hutterer cec4699986 default-profile: remove write-only field saved_profile 2021-08-06 08:03:27 +00:00
Nils Tonnätt f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Wim Taymans 9229467f20 module-zeroconf: only free impl when not NULL 2021-08-05 15:49:38 +02:00
Wim Taymans 4be14c24f5 stream: improve latency param debug 2021-08-05 15:42:38 +02:00
Wim Taymans 874724877d filter: handle NULL latency param 2021-08-05 15:42:23 +02:00
Wim Taymans 83422ba62d pulse-server: bump version to 15.0.0 2021-08-05 13:32:09 +02:00
Wim Taymans dc6a81520d media-session: always call va_end 2021-08-05 13:32:09 +02:00
Pauli Virtanen 76bae0cac4 media-session: add bluez-autoswitch module
Add module that switches bluez device profile to HFP/HSP if an input
stream (non-monitor, autoconnect) appears, and the current default
output device is bluez one that does not have input route.

When all input streams are gone, switch all changed profiles back.

Pending restore state is saved to session manager state files, in order
to restore it if e.g. devices get disconnected.  This usually is not
currently necessary since the bluez5 plugin prefers to connect to A2DP
over HFP, but might matter in future with backchannel-enabled A2DP
codecs.
2021-08-05 11:27:06 +00:00
Peter Hutterer 5e5bf5f340 doc: don't double up the pw_proxy_new() documentation 2021-08-05 09:51:40 +00:00
Nils Tonnätt 761fa6f59d meson: fix meson test without building pipewire before
This adds project internal dependencies to some tests to let all
tests succeed. It is not adding all dependencies those tests actually
need.
2021-08-04 20:38:30 +02:00