Commit graph

1916 commits

Author SHA1 Message Date
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
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
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
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
Wim Taymans
49846d7550 alsa-seq: only mark hardware ports as terminal/physical
Use the caps of the port to set the right flags on the new port.
We only want to put the terminal/physical flags on ports that look
like hardware ports. Port created by clients should not have this
flag.
2021-03-04 20:16:28 +01:00
Wim Taymans
3af768f124 resample: take into account the number of queued input samples
Take the queued input samples into account when calculating the
required input size. This can be 0 when there is still enough
data queued in the input for another period.

Handle 0 read_size in alsa-source and make it push out a 0 buffer,
this will then drain the resampler and make it ask for a new buffer
size. This makes the transition from one period to another more
seamless for the resampler.

Fixes #805
2021-03-04 10:27:44 +01:00
Wim Taymans
e15104c5cb alsa: make resync less aggressive 2021-03-04 10:20:08 +01:00
Wim Taymans
c135f9c7ee alsa: always set read_size 2021-03-04 10:13:26 +01:00
George Kiagiadakis
9168ec4335 backend-hsphfpd: fix compilation 2021-03-03 18:57:48 +00:00
Wim Taymans
e210c5f21c alsa: include headroom in silence buffers 2021-03-03 17:15:23 +01:00
Wim Taymans
a36af57899 alsa: reschedule the timeout based on new quantum
Always reschedule the timeout based on the new quantum. If the
quantum descreased we want to wait some more until the buffer only
has the new quantum of samples left.
2021-03-03 17:01:12 +01:00
Wim Taymans
3bcc59120a alsa: fix timeout adjustment
Only adjust the timeout when the quantum increases so that we end u
with exactly the number of samples of the new quantum.

Suppose we are handling a quantum of 1024, we wake up with 1024
samples in the device, we now notice a quantum of 8192 and will pull
in the 8192 samples, we then have 1024 + 8192 samples in the buffer.
Schedule a timeout for 1024 samples so that we end up in the timout
with 8192 samples in the device.
2021-03-03 16:55:40 +01:00
Wim Taymans
8981e11c53 alsa: various improvements
Remove some magic constants that are not needed anymore with the
headroom.
Clamp the error to some reasonable value so that we don't adjust the
rate too much but still apply all of the correction calculated by the
dll.
Remove the bandwidth adjustment.
Also update the matching and resample fields when we reassign the
node to a new driver. This could cause the new follower to not activate
the adaptive resampler and get out of sync.
2021-03-03 15:40:10 +01:00
Wim Taymans
c8804c3d6d context: make a new node.max-latency property
node.latency also influences the pipeline latency in that it can
push the latency above the default value.
node.max-latency, instead, is only used to clamp the final latency
of the pipeline.
2021-03-03 13:27:48 +01:00
Pauli Virtanen
4389e44903 bluez5: emit props change events only if values actually changed
This may avoid infinite loops if parameters are being set based on events
sent by parameter changes. It's also what alsa-acp devices do, so bluez5
should follow.
2021-03-02 23:46:27 +02:00
Pauli Virtanen
302282ef59 bluez5: set channel information for hfp/hsp transports
Fixes volume problems.
2021-03-02 22:20:44 +02:00
Arnaud Ferraris
8b97416417 json: add integer parsing functions
While most numeric values used in pipewire are floating-point values, it 
can still be useful to be able to directly parse integer values.
2021-03-02 18:06:55 +01:00
Huang-Huang Bao
97cc27600a bluez5: add missing function defination 2021-03-02 14:08:14 +00:00
Frédéric Danis
0e2a153bd3 bluez5: Start only one backend at a time for HSP/HFP
This will prevent to run the different backends concurrently.

The native backend will only register to BlueZ if neither oFono nor
hsphfpd are running. If one of them starts, the native backend will be
unregistered and the corresponding backend will register to its daemon.
2021-03-02 09:43:16 +00:00
Wim Taymans
1dfa36d77b alsa: reconfigure max latency based on buffer size
We can't ever support a latency larger than half the buffer size.
Take a fourth of the buffer size to have some extre headroom.

See #724
2021-03-02 10:34:41 +01:00
Wim Taymans
00d8d1472d channelmix: fix 7.1 to quad downmix 2021-03-01 19:51:14 +01:00
Wim Taymans
00e52ec167 resample: in drain, feed silence in all channels 2021-03-01 18:09:24 +01:00
Wim Taymans
5ae286702e audioconvert: make sure we update the flags
When we get a param update, update with the new flags.
2021-03-01 17:01:46 +01:00
Wim Taymans
157d423246 bluez5: remove stray route param field
This info is also in the classes field.
2021-03-01 16:55:16 +01:00
Wim Taymans
9662bc96ab null-audio-sink: support and prefer planar F32P
It's easier to convert to and also the native format for the converter
so that it can operate in passthrough mode without any copies.
2021-02-26 21:15:14 +01:00
Wim Taymans
d5d8150e05 fmtconvert: prefer planar formats when possible
It's easier to convert to and from.
2021-02-26 21:14:35 +01:00
Wim Taymans
50437029a3 channelmix: improve debug, add passthrough state 2021-02-26 21:12:11 +01:00
Wim Taymans
e2181c582d audioconvert: fix channel remapping some more
See #461
2021-02-26 18:40:04 +01:00
Wim Taymans
f7d756460e alsa: add option to use device channel map instead of default
See #461
2021-02-25 21:16:16 +01:00
Wim Taymans
6ce3705f5e fmtconvert: fix channel remapping 2021-02-25 17:41:50 +01:00
Wim Taymans
d080cd4819 channelmix: fix 7.1 to stereo and 3.1 downmix 2021-02-25 16:18:40 +01:00
Wim Taymans
20eb61b882 alsa: sync with pulseaudio 2021-02-25 10:28:25 +01:00
Pauli Virtanen
6114ca7c4a bluez5: fix queueing codec switches
Make queueing a codec switch work properly.  When receiving the dbus
reply, it should move to latest one. Others should be discarded.

Previously, it instead hit an assert, if there were more than two
queued.
2021-02-24 21:14:25 +00:00
Gleb Popov
fd544544ab Link v4l2 plugin to libinotify on FreeBSD 2021-02-24 19:29:57 +00:00
Wim Taymans
9e09461113 alsa: gracefully handle NULL params 2021-02-23 18:20:37 +01:00
Wim Taymans
d2fb6db21f alsa: use configured rate and channels when enumerating formats
When we have a rate or channels configured, set this in the hw_params
to restrict the enumeration of the remaining parameters. If we,
for example want 8 channels, some cards restrict the formats in that
case and we don't want to enumerate impossible combinations.

Fixes #782
2021-02-23 17:17:14 +01:00
Wim Taymans
8414092763 Rework profile/route handling
Add save property to Profile and Route params to notify the session
manager that they should be saved. Let the session manager only save
the Profile and Routes with the save flag.
Make pulse-server set the save flag on Profile and Route changes.
The result is that we can make a difference between user requested
changes and automatical changes and only remember the user preferences.
When a port changes availability, first check if we need to perform
a profile switch, if not select the new best port.
2021-02-22 16:51:59 +01:00
Wim Taymans
c067fd0a20 alsa: log device name in visible debug messages 2021-02-22 10:07:50 +01:00
Pauli Virtanen
a5dc2493df bluez5: route shouldn't list a2dp profiles when not connected 2021-02-19 21:16:27 +02:00
Wim Taymans
715a3a642a jack: handle client init error with -EIO 2021-02-19 16:10:34 +01:00
Wim Taymans
44919c83fc audioconvert: keep better track of param changes
Keep track of the param changes with the user counter. Make sure to
flip the serial switch whenever a change is pending. Previously
we copied the param from the channelmixer or follower but that
did not always result in a serial change.

Fixes #764
2021-02-19 09:57:59 +01:00
Frédéric Danis
7a5a944704 bluez5: backend-native: Check volume values
The value from +VGM/+VGS AT commands or events should be between 0 than 15.
2021-02-18 18:32:21 +00:00
Wim Taymans
930b411075 bluez5: set the right volumes on the node 2021-02-18 19:25:04 +01:00
Wim Taymans
8c5ca000ef bluez5: volumes need to be distributed to all channels
Otherwise some channels might become silent.

See #741
2021-02-18 17:47:22 +01:00
eater
6a21909281
spa: escape double quotes 2021-02-18 14:01:28 +01:00