Commit graph

5793 commits

Author SHA1 Message Date
Thibault Saunier 485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
Pauli Virtanen 98bedb3895 bluez5: don't set a2dp codec for source device initial profiles
Source devices don't have the a2dp codec profiles, so don't set a codec
profile as the initial one.
2021-03-10 21:32:01 +02:00
FeRD (Frank Dana) 2931522d2c pw-cli: Make 'dump' type arg case-insensitive 2021-03-10 11:41:32 -05:00
Wim Taymans e334c5862e pulse-server: fill in the format info 2021-03-10 17:27:11 +01:00
Wim Taymans d5fc67cf06 pulse-server: Prefer the formats of the extended format API
Fix enumerate the formats from the extended API and then append
the old API formats.

See #876
2021-03-10 16:55:01 +01:00
Wim Taymans ef4b3c403e media-session: -1 as node.target is default
A node.target property of -1 also means to follow the default
sink/source. The ALSA plugin might use this to select the
target node and would otherwise not move to the new default sink.
2021-03-10 15:27:06 +01:00
Wim Taymans 78e9e5958e impl-node: delay starting the driver node
Only start the driver node after we have added ourselves to the
driver node or else we might start too soon, before there is anything
to schedule and we cause driver underruns.
2021-03-10 13:28:56 +01:00
Wim Taymans 62def0399f impl-node: rework link activation
Only activate the links when the node is added to a driver. Otherwise
the driver will expect us to decrement the activation counters for the
links but that won't happen because the node will not be processed
yet.

Instead we activate the links that were not activated yet when the
node is activated.

This improves scheduling for newly added links and nodes.
2021-03-10 13:06:02 +01:00
Wim Taymans cc26ef9614 impl-node: update the io position from the data-loop
So that the update is synchronized with the data processing and
we don't accidentally process an old driver activation.
2021-03-10 13:03:34 +01:00
Wim Taymans 4f816c1fb0 loop: never try to block in the thread
When we are calling invoke from the thread, the call will be completed
in the thread and there is no need to block for completion.
2021-03-10 13:01:19 +01:00
Wim Taymans 0881d5b881 context: restart graph recalculation when something changed
When we were busy with the graph recalculation and something changed,
restart the graph state change to get the new change applied.

For example, when we start a node and it has a max-quantum set, we
need to restart our calculation with the new quantum limits.
2021-03-09 15:48:47 +01:00
Wim Taymans 63a34f4f84 alsa: after XRun, fill with previous threshold
It is possible that the quantum has changed before the xrun and
then we will assume the previous quantum was in the device.
2021-03-09 15:46:44 +01:00
Wim Taymans aa0e0043d3 alsa: only recompute threshold when quantum changes 2021-03-09 13:21:50 +01:00
Wim Taymans dd0342167f policy-node: move variable up in scope
We are using it outside of the scope it is defined in.
2021-03-09 12:48:48 +01:00
Wim Taymans fc044a37af resample: don't copy too much
When we are in passthrough mode, copy only the min of input and
output size or else we might overread/overwrite.

See #875
2021-03-09 12:47:38 +01:00
Wim Taymans c0ab4b1b8d bluez5: fix compiler warning 2021-03-09 12:25:20 +01:00
Wim Taymans c237ccfbda pulse-server: use the manager sync method for async replies
Use the manager sync method to wait until all pending queries are
finished. It is the manager that will query the new parameters so
we need to wait until that completes.

See #868
2021-03-09 12:09:05 +01:00
Wim Taymans 82c452a93d pulse-server: expose sync method 2021-03-09 12:08:45 +01:00
Wim Taymans d29bdf64ee pulse-server: reply async to some requests
Trigger a roundtrip before we send the reply to the client for many
methods like set_volume/set_mute etc.

this ensure that we get the updated information from the server before
we reply so that a subsequent query returns the up-to-data information.

Fixes #868
2021-03-09 09:55:48 +01:00
Pauli Virtanen 808b54bc19 bluez5: sco-io: fallback packet size when read size unknown should be even
Reported write MTU is odd for some adapters, which will misalign CVSD
frames, so round fallback value to even.
2021-03-09 08:03:21 +00:00
Wim Taymans e095105e57 resample: fix passthrough check
Only in passthrough we need to just copy input to output. Otherwise
we need to ask the resampler for the conversion size.
2021-03-09 08:52:43 +01:00
Pauli Virtanen 511bafb436 bluez5: release transports on profile change
SCO transports have timer-delayed release, but they need to be released
immediately when changing profiles to close connections before switching
to A2DP.
2021-03-08 23:42:08 +02:00
Wim Taymans 6fd870a5f0 alsa: pass the right direction to ucm_set_port()
The function requires true for playback ports and false otherwise.

See #867
2021-03-08 17:40:32 +01:00
Wim Taymans cab5cf3ccb alsa: add resampler delay in clock delay reporting 2021-03-08 17:12:00 +01:00
Wim Taymans 99b2973c31 resample: disable when not used. 2021-03-08 16:55:56 +01:00
Wim Taymans 2c1f8af2e6 alsa: correct dll error after quantum change
When the quantum is changed, the error between the current and
expected buffer levels needs to be corrected with the quantum
difference.

For example, say we are running with a 1024 quantum and the quantum
is changed to 8192, when we wake up the filled level might be
1016 vs expected 8192, 1024 - 8192 = -7168. The real error for the
timeout was 1016 - 8192 - (-7168) = -8.
2021-03-08 16:29:53 +01:00
Wim Taymans ffeb2e0f0e alsa: fill with right amount of silence when starting
When we start or after an xrun, we need fill the buffer with one
period + headroom of samples, not period*2. This is because after
start we set our timeout immediately and expect there to be
period + headroom samples in the buffer.

With period*2 we take one period longer to start and we also feed
one period of error in the dll, which causes it to wobble for no
good reason.
2021-03-08 15:36:58 +01:00
Wim Taymans 1b6060ef5f media-session: schedule more rescan for pending changes
Trigger/delay a rescan until the profiles, routes and stream
volume are restored.

See #789
2021-03-08 15:14:40 +01:00
Wim Taymans d603c1086a media-session: (re)schedule rescan after new pending operation
Every time a new operation is started, schedule a rescan. This
ensures that there are no more pending actions before the policy
module scans the nodes.

This has the effect that all devices and nodes are up to data and
ready to be used by policy-node.

Fixes #789
2021-03-08 13:20:02 +01:00
Wim Taymans 59f86df9f3 media-session: move profile switch to default-profile
Move the profile switching from default-route to the default-profile
module. This makes more sense and it also allows us to restore the
saved profile when it becomes available.

Make default-profile always check if the saved profile can be restored
before attempting to switch to the best profile.

Default-route now just monitors profile changes and restores the
routes associated with it.

See #466
2021-03-08 11:52:38 +01:00
Wim Taymans 3e2d897f97 jack: improve debug 2021-03-07 10:46:08 +01:00
Wim Taymans 6c8c58ab4e jack: also match system ports in get_ports
Fixes #850
2021-03-07 09:44:40 +01:00
Wim Taymans ffab69f651 jack: move some debug to info
Use info to lay out the general app flow
2021-03-07 09:44:04 +01:00
Wim Taymans 2aa261659d pulse-server: handle NULL default_sink/source
Don't crash when default_sink/source is NULL

See #676
2021-03-07 08:18:11 +01:00
Pauli Virtanen a99f3a90ef bluez5: correct EnumRoute availability
Mark bluez5 routes always available in EnumRoute, because there's always
a device connected.

Fixes default-route resetting profiles back, when they are manually
changed.
2021-03-07 01:37:57 +02:00
Wim Taymans 6324298bc5 channelmix: add more generic upmixing
Add options to enable lfe filtering and upmix.
Enable upmix by default, lfe is disabled because we don't actually
do a lowpass filter yet.
2021-03-06 21:31:18 +01:00
Wim Taymans c7309f0248 channelmix: small cleanups
Fix indent
Rename DUAL/QUAD to REAR and SIDE and use it for checking availability
of stereo pairs.
2021-03-06 21:29:36 +01:00
fdev31 4d21b5f8bd Simple upmix of stereo inputs up to 7.1 output 2021-03-06 20:22:09 +00:00
Wim Taymans 5712992fc9 stream-restore: Don't save the default sink/source as a target
If the default sink or source is set as the target, just don't save
the new target so that it follows the new default.

This is a workaround for gnome-control-center first setting the
default source/sink and then setting the targets on all
stream-restore database entries to the new default. Setting an
explicit target will pin the stream to that sink/source forever,
which is then making pavucontrol default source/sink toggle
fail.

See #676
2021-03-06 20:08:11 +01:00
Wim Taymans d9b80fda37 pulse-server: set our default sink/source immediately
In COMMAND_SET_DEFAULT_SINK/SOURCE, set our default source and sink
immediately instead of waiting for the metadata update. This makes
it possible to check for the new default sink immediately in other
modules.
2021-03-06 20:06:06 +01:00
Wim Taymans dbebbe2f33 pulse-server: support NULL set-default-sink/source
It is allowed to set a NULL value for the default source/sink, which
then simply clears any configured value.
2021-03-06 19:58:52 +01:00
Pauli Virtanen e42261c6d2 bluez5: remove per-device codec filtering
This does not work as intended, because we no longer do a codec switch
on device connect.  It should be done in a different way, but since it's
not used for anything right now, can as well remove it.
2021-03-06 15:19:14 +02:00
Wim Taymans 662fd8a1f9 pulse-server: avoid crashing when clearing metadata
The key will be NULL so we can't strdup it.

Fixes #845
2021-03-05 20:16:29 +01:00
Wim Taymans 1c365f6169 policy-node: fix compiler warning 2021-03-05 20:16:05 +01:00
Wim Taymans c8fd34a41d metadata: store default-nodes as JSON
Don't just store the id in the metadata but a JSON object with
the node name. This makes it possible to easily introspect the
metadata and also extend the metadata with more fields later.

Instead of matching the metadata id to the global ids we now
have to match it against the name.
2021-03-05 17:37:12 +01:00
Wim Taymans 8d5cc7013d conf: write valid JSON by putting , between keys
Separate keys with , to make a valid json file
2021-03-05 12:40:28 +01:00
Wim Taymans b40397d986 media-session: check metadata before using it
The session manager might be configured without metadata support
so check this before attempting to use the metadata. It's not
really a problem because the default sink/source can only be
changed with the pulseaudio API, which activates metadata.
2021-03-05 10:34:27 +01:00
Wim Taymans 93002ecd11 media-session: remove unused prefix from load/save state
The prefix was used to filter the properties when loading and
saving but since the conversion to the core provided functions, this
feature is not longer available.

It's not exactly a problem, we could implement the filtering ourselves
afterwards but there is little point because we just ignore the unknown
items and never write invalid items.
2021-03-05 09:23:19 +01:00
Wim Taymans e89e87ba94 alsa-seq: generate the same name as a2jmidid
It is more descriptive and more compatible.
If we change Midi-Bridge to a2j, some apps will parse our port names
in a special way, even (catia).
2021-03-04 20:40:07 +01:00
Barnabás Pőcze 3c01cfe8f8 protocol-native: connection: fix errno check condition
The branch should be taken if errno is neither EAGAIN,
nor EWOULDBLOCK.

Previously,

  if (errno != EAGAIN || errno != EWOULDBLOCK)

would be taken for all values of errno if EAGAIN != EWOULDBLOCK.
(Except for the ones that are filtered out before.)

Fix that by changing `||` to `&&`.
2021-03-04 19:18:19 +00:00