Commit graph

10650 commits

Author SHA1 Message Date
Wim Taymans
45b2983439 aec: add new init2 method to initialize with different formats
The WebRTC echo canceler can support different rates and channels for
the record, out and playback streams.

Add a new method to pass this config to the echo-canceler.
2023-04-11 16:54:11 +02:00
Wim Taymans
8748c77451 context: make driver runnable when we add a runnable node
Explicitly make the driver runnable when we add a runnable node to it.

We have to do this because the runnable node might not be directly linked
to this driver.

In the case of the echo-canceler, for example, a playback stream
can be linked to the sink before the echo canceled virtual sink.
All echo-cancel nodes are added to a source driver, which would not be
activated because there is no direct path from the playback stream
to the source river.

Fixes #3145
2023-04-11 16:31:44 +02:00
Pauli Virtanen
5d1782760c bluez5: media-sink: resync ISO streams on playback start
Resynchronize ISO streams on playback (re)start, so the stream positions
are aligned immediately.  This is better than relying on rate matching
to correct any offsets.
2023-04-10 14:50:42 +00:00
Wim Taymans
261fb64849 alsa: separate max_error and max_resync
Use a separate variable to hold the maximum amount of drift we allow
between driver and follower. Ensure this value is smaller than the max_error
and period size so that we have at most 1 period of drift.
2023-04-10 16:28:55 +02:00
Wim Taymans
30657abf28 alsa: also set period size when using IRQ mode
Use the graph duration as the period size even when we are not using
a batch device.
2023-04-10 16:07:24 +02:00
Wim Taymans
d59e1094cd alsa: fix capture timings and drift
Don't reschedule a timeout when we have less samples available than the
target but only reschedule when we have less that the required amount we
need to read. This ensures that we hover around the target level and the
timeouts/rate matching adapts correctly. Previously we would only rate
match if the have at least the target amount of samples, which would
then always result in a possitive rate adjustment and cause drift.

For capture, make sure that there is at least 32 samples of headroom
when we are not using IRQ mode to handle jitter in the timer wakeup.

For capture of batch devices this results in (for a 1024 quantum) a
target buffer fill level of 1024 + 512, and we will read if there are at
least 1024 samples available.

For non-batch devices we aim for a target buffer fill level of 1024 + 32
and read if there are at least 1024 samples available.
2023-04-10 15:02:29 +02:00
Wim Taymans
4b6e0df411 jack: refactor get_time_ns function 2023-04-10 14:45:27 +02:00
Wim Taymans
501a80b247 alsa: fix rate match when using IRQ
When using the IRQ, we are woken up based on processed samples so
compare expected and current clock times to rate match the clock.

Fixes #3144
2023-04-10 13:18:25 +02:00
Pauli Virtanen
882f9ad2b3 bluez5: emit BAP device set nodes as needed
Emit BAP device set nodes, which the session manager can use to combine
the sinks/sources of a device set to a single sink/source.

Emit the actual sinks/sources with media.class=.../Internal to hide them
from pipewire-pulse.

Add separate device set routes to the set leader device.  Other routes
of the set members will be marked as unavailable when the set is active.

Accordingly, return failure for attempts to set these unavailable
routes, so that volumes etc. of the "internal" nodes are only controlled
via the device set route.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
1a44754f8d bluez5: wait for devices in the same set before emitting nodes
Emit nodes only after all devices in the same set are ready, or until
add timeout elapses.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
d642569394 bluez5: parse device set information via dbus
Parse device set information from DBus, and link devices to each other
according to it.  Add signal for notifying about device set changes.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
eca13ec230 bluez5: iso-io: get BAP interval from dbus, not getsockopt
For ISO server sockets, the QOS struct from getsockopt contains values
with different meaning from ISO client socket. Get the values via DBus
instead, which is right in both cases.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
ae76789f24 bluez5: iso-io: ensure streams are initially marked idle
Mark streams idle when they are being stopped/started, so that the
pause-to-sync logic always triggers when they are added.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
6e94487057 bluez5: set BAP channel location from transport if unset
If BAP codec configuration is mono channel with unspecified location,
set the channel position from transport location.

This in principle should be set in SelectProperties, but currently BlueZ
doesn't tell us that yet there, so we hack it up later on.
2023-04-10 07:00:44 +00:00
Pauli Virtanen
8f840e703b bluez5: lc3: number of blocks is not the number of channels
The number of channels is determined by Audio_Channel_Allocation.
One frame block contains all channels. (BAP v1.0.1 Sec. 4.2)

Fix the handling of frame blocks and counting of numbers of channels. We
support and configure only one frame block per packet.

Consider omitted Audio_Channel_Allocation to indicate MONO stream (see
BAP v1.0.1 Sec 4.3.2).
2023-04-10 07:00:44 +00:00
Pauli Virtanen
e4cd99f76f bluez5: add some debug for media-sink 2023-04-10 07:00:44 +00:00
Forest
252620a18d alsa-profiles: SB Audigy: stereo mixer paths
This is a follow-up to d5390c7, where we switched to the 'PCM' mixer controls
on Sound Blaster Audigy devices, since the ones we used before only work in the
stereo-to-all-speakers mirroring mode.

It turns out we do use that mode after all, but only in a couple of profiles.
Since returning those profiles to the default mixer path yields uneven volume
steps similar to #2934, we instead add a new mixer path just for that mode.
2023-04-09 12:20:26 -07:00
Forest
1e77a7cc51 alsa-profiles: SB Audigy: rename path config file
This makes the file name consistent with the other device-specific ones.
2023-04-09 12:14:39 -07:00
Forest
6939c1e4ee alsa-profiles: SB Audigy: remove absent elements
Some of the elements/keys that were copied from analog-output.conf are not
implemented by the Audigy driver, so we don't need to reference them.
2023-04-09 12:14:29 -07:00
Pauli Virtanen
772ff3365b bluez5: backend-native: add two missing OK HFP replies
We should reply OK to both AT+BIEV and AT+IPHONEACCEV.
2023-04-08 11:05:06 +00:00
Forest
d5390c7199 alsa-profiles: use SB Audigy PCM mixer controls
Creative Labs Sound Blaster Audigy cards (snd_emu10k1 driver) expose
mixer controls named 'PCM Front', 'PCM Rear', etc. in addition to the
more common 'Front', 'Rear', etc.  The latter seem to be intended for
a stereo-to-all-speakers mirroring mode that we do not use, and have
no effect when we adjust them.
https://docs.kernel.org/sound/cards/audigy-mixer.html

We therefore define a custom mixer path for Audigy devices, using the
PCM mixer controls.

This has been tested on an Audigy 5/Rx.  Based on a brief look at the
ALSA driver, I think all Audigy devices (vendor 0x1102, device 0x0004
or 0x0008) have the same PCM controls, making this change probably safe
for our existing Audigy udev rules.

Relevant kernel files:
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emufx.c
include/sound/emu10k1.h

Fixes #2934
2023-04-07 21:15:38 +00:00
Wim Taymans
f64c21ed81 filter-chain: fix bq_raw activate
The raw biquad takes its values from the config and then updates the
control ports with them in activate. At runtime, the changes to the
ports are applied to the biquad.

Other biquads take values from the config ports in activate.
2023-04-07 16:45:28 +02:00
Wim Taymans
880c1b0bd6 module-filter-chain: add raw biquad
Add bq_raw that allows access to the raw biquad filter values.

Fixes #3139
2023-04-06 18:28:49 +02:00
Wim Taymans
950c4487e9 0.3.68 2023-04-06 12:34:43 +02:00
Wim Taymans
148569279b pulse-server: add enable_opus support in rtp-send 2023-04-06 12:10:46 +02:00
Wim Taymans
0520db8d5f module-sap: add opus to sap receiver 2023-04-06 12:10:25 +02:00
Wim Taymans
e5cf9ba1fd modules: update docs 2023-04-06 11:49:25 +02:00
Sourav Das
8cf9986774 spa:bluez5: fix compilation
on lower bluez version, BT_ISO_QOS macro is not available
    So, need to check it also fixes the compilation.
2023-04-06 09:19:47 +00:00
Aleksandr Melman
acbef8d507 Replace ru.po 2023-04-06 08:05:44 +00:00
Wim Taymans
463e723a1e test: add more lossless tests
Also test that S16->F32->S32 and U16->F32->U32 are lossless.
2023-04-06 10:00:17 +02:00
Wim Taymans
edf2062830 fix compilation 2023-04-05 19:53:33 +02:00
Wim Taymans
6dcf0027d8 audioconvert: implement mix/resample_disabled
Fail when resampling or channelmixing is required but disabled.
2023-04-05 19:51:16 +02:00
Ashok Sidipotu
805a1c61d9 adapter-control: avoid the divide by zero while generating sequence. 2023-04-05 16:33:09 +05:30
Ashok Sidipotu
7dbad54ae5 audioconvert: donot return errors in the volume ramp setparams
Also avoid the divide by zero while generating sequence.
2023-04-05 16:27:48 +05:30
Wim Taymans
7f7821c3f2 module-raop: handle 0 timing_port
When the timing_port is 0, just don't send out an initial timing packet.

When we receive a timing packet, reply to the same address/port that the
timing packet was sent from.

Fixes #3133
2023-04-04 17:55:02 +02:00
Wim Taymans
e0a09ccf31 private: don't block context related problems, just emit a warning 2023-04-04 16:20:10 +02:00
Wim Taymans
74831aa967 support: add support for checking loop context
Add check for running the the loop context and thread.

Add checks in filter and stream to avoid doing things when not run from
the context main-loop because this can crash things when doing IPC from
concurrent threads.
2023-04-04 16:19:41 +02:00
Wim Taymans
a6497839bb stream: move some code around
So that we don't have to call public API internally. We might want to
add some checks there later that don't need to happen when called
internally.
2023-04-04 16:16:47 +02:00
Wim Taymans
f2be2923e6 thread: use pthread_equal to compare thread ids 2023-04-04 12:43:25 +02:00
Wim Taymans
edbfd180d0 thread-loop: only restore recurse on error
Only restore the previous recurse state when we fail to unlock.
2023-04-04 12:20:56 +02:00
Wim Taymans
aa2ea737c7 thread-loop: add some additional check
Check for errors from pthread_ functions and log an error.
Check the recursion count to check if locks were correctly taken.
2023-04-04 11:34:03 +02:00
Wim Taymans
796a0d2cfe thread-loop: small cleanup
Use named fields for the event, prefix function.
2023-04-04 11:12:13 +02:00
Wim Taymans
8b1902c825 echo-cancel: reset buffers in suspend
Or else some stay samples from the previous run might be played when
resuming.
2023-04-04 10:17:44 +02:00
Wim Taymans
9664787cff context: Only activate runnable nodes
Rework the runnable state calculation. It works in 2 steps now:

1. Collect all nodes linked to a driver in some way. Mark nodes that
   are reachable with a non-passive link as runnable.
2, Go through all runnable nodes and set all linked nodes to the
   runnable state as well, up to the driver.

Step 2 is new. Previously if there was just one runnable node, *all*
nodes would be set to runnable. With the addition of step 2, some nodes
might remain idle when they are not used.

This has the effect that virtual sinks without inputs stay idle when
the driver is otherwise running. Grouped nodes (like the RTP session)
will now also only run the linked nodes.
2023-04-04 10:17:44 +02:00
Wim Taymans
d41d8cf983 audioconvert: fix return values
Return negative error numbers for errors.
2023-04-03 21:34:10 +02:00
Wim Taymans
e5809cf4f4 spa: move audio props to audio section 2023-04-03 21:30:11 +02:00
Ashok Sidipotu
dcec2e785e audioconvert: add a invalid value for scale
The invalid value here is zero, this will help avoid inadvertant parameter
updates and brings this on par with rest of the volume ramp parameters
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
b61bf8a27d adapter-control: bundle the volume ramp parmeters with volume 2023-04-03 19:04:55 +00:00
Ashok Sidipotu
74872250e8 audioconvert: make volume ramp parameters non-sticky
This mean the volume ramp parameters will have to be issued along with volume
every time. They will not be persistant.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
737bc89ab9 audioconvert: grow the volume ramp buffer
Grow the volume ramp sequence command buffer dynamically, if needed.
2023-04-03 19:04:55 +00:00