Commit graph

1735 commits

Author SHA1 Message Date
Peter Hutterer
1a5faa7b52 spa: add a header for ANSI color sequences
Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
2021-06-02 14:17:29 +10:00
Wim Taymans
620e8de52a acp: copy the db_fix key as well
Or else we will try to free the original key twice and segfault.

Fixes #1125
2021-06-01 12:43:08 +02:00
Wim Taymans
f544e4d87c acp: reset volume when enabling a device
When we enable a device, the node will be created and its software
volume will be set to 100%. Update the device volume with this as
well so that changing the volume has an effect.

Fixes #1198
2021-06-01 11:47:59 +02:00
Wim Taymans
bc6e11d6e4 audioconvert: move some info to debug 2021-05-31 16:17:43 +02:00
Hui Wang
e375930813 alsa-mixer: only use switch to mute Front in the Headphone path
According to the alsa-info.txt in the pipewire issues of #747 and #1206,
the Front Playback Volume is shared by Headphone and Lineout or
Headphone and Speaker, But Headphone, Lineout or Speaker they all have
independent Playback Switch, change to only use switch to mute the
Lineout or Speaker. This could resolve the issues of #747 and #1206.

See #1206 and #747
2021-05-31 13:08:19 +02:00
Wim Taymans
4dc3d79ff2 alsa: sync with pulseaudio 2021-05-31 13:03:52 +02:00
Huang-Huang Bao
e953bb3238
meson: fix build if bluez5 option is disabled
Don't look up codecs dependencies and don't include 'bluez5' subdir if 'bluez5' option is disabled or libbluetooth is not found.
See https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/707.
2021-05-28 21:01:38 +08:00
Huang-Huang Bao
38bcec9022
bluez5: add port latency reporting 2021-05-28 20:02:10 +08:00
Huang-Huang Bao
d8435cd5fd
bluez5: use definations to index node and port params 2021-05-28 19:40:19 +08:00
Barnabás Pőcze
c851349f17 spa: logger: fix potential buffer overrun when message is long
If the message was too long, then the `vsnprintf()` call would
fill up `location`, leaving no space for the color escape sequence
and the newline, causing a stack buffer overrun here:

  size += snprintf(p + size, len - size, "%s\n", impl->colors ? suffix : "");

Fix that by reserving the last 24 bytes of the message buffer.
2021-05-28 09:40:11 +00:00
Wim Taymans
70722c0741 channelmix: provide some more upmix options
If nothing else is possible, also try to upmix from FC

See #1237
2021-05-27 18:08:07 +02:00
Wim Taymans
0222e408e0 audioconvert: use the right latency param
We need to use the latency param of the port direction to configure
the other port.
2021-05-27 15:26:09 +02:00
Wim Taymans
b9b89b92b2 spa: add some latency helpers
Add more fields to the latency object.
Add methods to create, parse and process latency info.
2021-05-27 15:26:09 +02:00
Wim Taymans
0779862cda alsa-seq: add port latency reporting 2021-05-27 15:26:09 +02:00
Wim Taymans
cd32404e92 port: implement latency reporting some more
Implement a port recalculate latency method that takes the min
and max latency of all peer ports and sets that as the new port
latency.
When a link is made, let the output and input port recalculate
latencies.
Pass latency param in audioconvert.
2021-05-27 15:26:09 +02:00
Wim Taymans
1cd6d7b01d spa: Implement latency reporting
Implement latency reporting in alsa
Implement latency reporting on audioconf by passing on the latency
from the follower to outside of the adapter.
2021-05-27 15:26:09 +02:00
Wim Taymans
46ef88e520 spa: save the old change_mask and restore when emitting full
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.

Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
2021-05-27 15:21:44 +02:00
Wim Taymans
751f9a9ea0 dbus: make sure we don't unref a NULL dbus connection
See #1213
2021-05-26 10:52:38 +02:00
Peter Hutterer
e83f039833 alsa: free the strdup'd substring on error
n is the return value of pa_split()

Found by scan-build
2021-05-26 10:03:49 +02:00
Peter Hutterer
bc64b32798 bluez: fix a memleak on error
If the allocation failed, our strdup'ed path would leak.

Found by scan-build
2021-05-26 10:03:43 +02:00
Peter Hutterer
4dd886188a alsa: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
Johannes Wolf
799ba7de16 alsa-profiles: Add NI Komplete Audio 6 profile set 2021-05-26 07:35:25 +00:00
Georges Basile Stavracas Neto
f1cc525d7e Add channel paths to analog-surround-*
Motu M4 has four inputs (two line-in inputs, and two complete ones
with gain and XLR and whatnot), as well as four outputs (two monitor
pairs, and an unnaccounted headphone).

Sadly, like a few other interfaces, it wasn't being given an input
profile, since the matching code goes through default.conf testing
each config, and ends up selecting 'analog-surround-40', which does
not have input mapping. The inputs would fallback to 'multichannel-
input', which also doesn't have input paths.

Add input paths to all analog-surround-* mappings, and remove their
'direction=output' fields since they handle both out and in.
2021-05-25 18:41:22 -03:00
Valentin David
6216de6ca0
alsa: Add support for SteelSeries Arctis 9 Wireless 2021-05-21 14:39:45 +02:00
Wim Taymans
39a2636c9b alsa: clean up port and node params 2021-05-21 11:08:52 +02:00
Wim Taymans
89c10dad70 spa: Clean up some of the param handling 2021-05-21 10:10:38 +02:00
Peter Hutterer
71c6a175c4 Drop double semicolons 2021-05-20 07:24:22 +00:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
92514d57e4 treewide: replace plain strcmp() calls with spa_streq 2021-05-18 22:10:27 +10:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
9bbe5c7517 bluez: add a helper function for checking the message signature
strcmp() is easier to get wrong (or lack consistency) so let's abstract all
these calls with a little helper.
2021-05-18 22:10:26 +10:00
Peter Hutterer
65f5f2a6f8 alsa/v4l2: convdert udev's VID/PID from hex to decimal
udev's ID_MODEL_ID and ID_VENDOR_ID are inconsistent: always 4-digit hex but
sound devices are prefixed with 0x, v4l devices are not. Depending on the
actual ID, the value will look like decimal (1234) or hex (a234).

pw-dump will then print those as either decimal integers (i.e. 0x1234 becomes
decimal 1234) or double (i.e. a234 becomes 41524.00).

Make this consistent by converting the string from hex do decimal where we
get it.
2021-05-18 07:35:00 +00:00
Wim Taymans
a21c7f8457 acp: sync with pulseaudio
See #747
2021-05-17 17:26:25 +02:00
Wim Taymans
d8208c5c2d dbus: move connect to dbus in connection_get()
This way we can reset the dbus connection when we got a disconnect
and signal the event. This can then be used by the client to
do a new connection_get().
2021-05-17 13:17:27 +02:00
Wim Taymans
2dcdabd2af dbus: add events to the dbus connection
Add events to the dbus connection and notify about destroy and
disconnect.
2021-05-17 11:54:43 +02:00
Wim Taymans
40fbabd9ed dbus: listen for disconnect signal
And log a warning when our connection is lost.

See #1099
2021-05-17 10:20:28 +02:00
Barnabás Pőcze
c73ef2b9a1 spa: ffmpeg: use av_codec_iterate() when available
av_codec_next() was deprecated on 2018-02-06,
in lavc 58.10.100 (36c85d6e77). It was then later
removed on 2021-04-27 (4b2be3f8d). `av_codec_iterate()`
was added in lavc 58.10.100, so use that when available.

Fixes #1138.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
3baf3fcfec spa: ffmpeg: remove libavformat dependency
`av_register_all()` is the only thing used from libavformat,
but that doesn't seem to be needed for codec enumeration,
so remove it, and call `avcodec_register_all()` instead
when libavcodec < 58.10.100.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
3f567eeb56 spa: ffmpeg: fix FFmpeg name
ffmpeg.c had 'Spa V4l2 Support' in it, fix that to say
FFmpeg. Furthermore, change 'FFMpeg' to 'FFmpeg' in
ffmpeg-{enc,dec}.c as that is how it's referred to
in official texts.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
5a14e3970a spa: ffmpeg: remove hard-coded values
Use `sizeof` to query the size of the array instead of
hard coding it.
2021-05-16 13:10:59 +00:00
Huang-Huang Bao
03cde9751b
bluez5: guard against device profile
Invalid device profile should not be set.
2021-05-11 19:22:42 +08:00
Wim Taymans
d226a28b30 acp: reset soft_volume
Reset the software volume when initializing the device and when the
hardware volume is updated.

The software volume was set to 0 by default and if the session manager
did not change the volume enough to cause a software volume change,
it would remain 0 and there would be silence.

Also improve the debug a little.

See #1160 #1167 #1164 #1049 #1117
2021-05-10 10:50:42 +02:00
Wim Taymans
02decd9fba alsa: pause/resume when entering/exiting freewheel
When we start freewheeling, pause the device and resume when we
finish freewheel.
In freewheel mode, just discard samples in the sink and produce
silence in the source.
2021-05-07 11:51:22 +02:00
Wim Taymans
a80ec36ad5 node-driver: run as fast as possible in freewheel mode 2021-05-07 11:50:55 +02:00
Wim Taymans
888612dc0f conf: add freewheel driver
Add freewheel driver and enable freewheel mode on it.
2021-05-07 09:03:34 +02:00
Wim Taymans
5c41131d6d node-driver: support node.freewheel property
To activate freewheeling when initializing
2021-05-07 09:03:34 +02:00
Wim Taymans
efc497a38a spa: make a new FREEWHEEL clock flag
When freewheeling, the clock is going faster than real time.
When freewheeling, skip samples in alsa sink/source.
2021-05-07 09:03:34 +02:00
Peter Hutterer
cc4324cd30 spa/logger: only log in colors if we're logging to a tty 2021-05-07 06:57:31 +00:00