Commit graph

9530 commits

Author SHA1 Message Date
Wim Taymans
2d858e0ba2 spa: a Flush command does not stop processing
A flush command is not supposed to stop playback but just clear the
current state. Normally, to avoid complications, an application will
Pause, Flush and optionally Start to do things smoothly without
interfering with the process loop, but things should not crash if that's
not the case.

Fixes #2726
2022-09-26 11:10:02 +02:00
Wim Taymans
ed8be8e393 man: add some more see also manpages 2022-09-26 10:07:32 +02:00
Wim Taymans
78bfdd1717 raop: use pw_strip to string header values 2022-09-26 09:31:55 +02:00
Sebastian Koenig
fa20fb2e80 rtsp-client: remove trailing whitespace from header data
Some clients may send headers with trailing whitespace, which can upset
subsequent parsing of the data into numbers.  This patch removes such trailing
whitespace before further processing the header data.
2022-09-26 07:20:27 +00:00
Sebastian Koenig
fd66fb8867 raop: add support for ALAC codec
Some Airplay devices announce themselves as using the ALAC (Apple Lossless Audio
Codec) format, while pipewire only supports the PCM codec.  A look at the
Pulseaudio RAOP reveals that ALAC is supported there, but the encoding looks
exactly like what pipewire does for PCM.  This patch adds support for ALAC, but
it uses the existing PCM infrastructure to send the audio data.
2022-09-26 07:16:52 +00:00
Piotr Drąg
0c1e4475ba Update Polish translation 2022-09-26 07:16:12 +00:00
Ataberk Özen
10ac448b59 alsa-mixer: add support for Asus Xonar SE 2022-09-25 12:52:14 +03:00
Demi Marie Obenour
fea248d450 SPA POD parser: Fix bug when parsing choice types
spa_pod_parser_can_collect and spa_pod_parser_getv were inconsistent
with each other.  When parsing crafted POD, this could cause a type
confusion or stack overflow.
2022-09-24 15:52:53 +00:00
Pauli Virtanen
2e3347e850 bluez5: use HFP HF as default, not HSP HS
E.g. iphones don't support HSP, only HFP, so change the default to use
HFP HF instead of HSP.  HFP is now old, and most devices should support
it now.
2022-09-24 13:26:50 +03:00
Barnabás Pőcze
0a48165cff spa: bluez: backend-native: accept "=" for +VGS and +VGM
HFP 1.8 states in 4.35.1:

  Due to the small inconsistency between the GSM standard [2]) and the current
  Headset specification ([3]), the HF shall also accept the “=” symbol,
  in place of “:”, as a valid separator for this unsolicited result code.

iOS seems to use "=", so accept that as well.

See #2463
2022-09-24 02:47:58 +02:00
Barnabás Pőcze
0ee4fea03d spa: bluez: backend-native: fix HF/HS to AG message terminator
Both HFP and HSP require an AT command from HF/HS to AG to
be terminated by CR, not LF. (HFP 1.8, 4.34.1; HSP 1.2, 4.8.1)

See #2463

Fixes: 0b2d3730b6 ("bluez5: Add HFP HF support")
2022-09-24 02:45:41 +02:00
Barnabás Pőcze
2fb63f71c3 spa: bluez: backend-native: use sscanf() for parsing AT commands 2022-09-24 02:22:29 +02:00
Barnabás Pőcze
c24594a8ac spa: bluez: backend-native: fix type and add error checking 2022-09-24 02:22:19 +02:00
Barnabás Pőcze
8881030904 spa: bluez: backend-native: use strsep() instead of strtok()
`strsep()` is simpler to use than `strtok()` or `strtok_r()`
while being thread-safe and reentrant.

Although it is an extension, it is available in both glibc and musl.
2022-09-24 02:22:16 +02:00
Demi Marie Obenour
c1920163d5 Fix calls to sendmsg()
Align cmsg buffers properly and use MSG_NOSIGNAL.
2022-09-23 16:33:36 +00:00
Demi Marie Obenour
90c955c223 Replace more macros with accessor functions 2022-09-23 11:39:33 -04:00
Demi Marie Obenour
671a7102ff Fix some badly-behaved macros
Some macros evaluated their arguments more than once when it was not
needed, or were missing parentheses.
2022-09-23 11:39:33 -04:00
Demi Marie Obenour
bb4f274ae0 Make all fopen() calls use O_CLOEXEC
by adding "e" to the mode strings.
2022-09-23 15:19:01 +00:00
Demi Marie Obenour
400860f63c Add <stdint.h> includes
This is to make the headers standalone.
2022-09-23 15:19:01 +00:00
Wim Taymans
6fda8212e7 impl-node: refactor pause_node
Rename pause_node to idle_node and only perform the pause when
pause_on_idle is active.
2022-09-23 17:02:01 +02:00
Wim Taymans
69e6db5216 impl-node: only pause pause_on_idle nodes
When we are starting a node and need to cancel it, only set the node
to the paused state when pause_on_idle is set. Use the pause_node
function to make sure everything is in the paused state.

Otherwise we would send a Pause command to the node but because it was
still added to the graph we would continue to call the process function
on it.

Fixes #2701
2022-09-23 16:58:15 +02:00
Wim Taymans
7c93c29cfd add some more debug 2022-09-23 16:48:40 +02:00
Wim Taymans
e8aef6b4bd audioconvert: only Suspend should trigger negotiate
A Suspend should clear all the negotiated state and start a new
negotiation in Start. Use a flag to control this.

This avoids recalculation of state for each pause/play state change.

See #2701
2022-09-23 15:32:36 +02:00
Wim Taymans
9119e8a26e improve debug 2022-09-23 15:14:50 +02:00
Wim Taymans
ad8fa41678 audioadapter: warn when scheduling a stopped node
Log a warning when we try to schedule a stopped node.

See #2701
2022-09-23 11:30:42 +02:00
Balázs Úr
104a75656e Update Hungarian translation 2022-09-22 11:31:53 +00:00
Wim Taymans
e0614246f5 pulse-server: set fragsize as latency
Reducing the latency is just papering over the issue in #2702. The
real fix is to limit the blocksize to the fragsize like what is done
in 00a234daf2

Reducing the latency then also causes regressions like #2715 so don't
do that anymore.

Fixes #2715
2022-09-22 11:58:14 +02:00
Wim Taymans
71a918fae1 acp-tool: handle ctrl-D to exit
Fixes #2700
2022-09-21 17:32:13 +02:00
Jonas Holmberg
dacbeca77e alsa-pcm: Change resync warning logic
Log follower resync messages with info level until there has been a
successful read or write to get rid of the initial warning when starting
a stream.
2022-09-21 16:42:37 +02:00
Wim Taymans
ef39576150 alsa: rate limit some warnings 2022-09-21 15:52:24 +02:00
Wim Taymans
9632145c9a log: make some more macros
Make a macro to log at a certain level with func,line,file added.
Use the new macros to reduce some redundant arguments.
2022-09-21 15:50:41 +02:00
Wim Taymans
47f2b72088 pulse-server: don't overwrite previous towrite value
And actually take the MAX_BLOCK into account when writing samples to a
client.
2022-09-21 12:00:36 +02:00
Wim Taymans
00a234daf2 pulse-server: limit capture blocks to fragsize
Don't send larger chunks than the fragsize. Some clients don't like
this. Also checked with #2418.

Fixes #2711
2022-09-21 11:34:13 +02:00
Wim Taymans
bd584ca8c0 pulse-server: ignore adjust-latency for capture
Don't update the fragsize, it breaks #2418 again.
2022-09-21 11:34:13 +02:00
Wim Taymans
95cfb531a0 alsa: initialise the format
Otherwise the format is 0 (S8) and only S8 will be allowed.
2022-09-20 17:45:46 +02:00
Wim Taymans
7bf84fa5e2 pod: only call the overflow callback when still needed
When we are already past the size of the buffer, don't bother calling
the overflow callback anymore, the buffer is already corrupted.

Otherwise it would be possible to have the overflow callback fail the
first time around, some data will be skipped, and then the next
overflow callback would succeed, giving the impression that all is
fine.

Add a unit test for this.
2022-09-20 16:59:25 +02:00
Wim Taymans
c9753b0722 alsa: rework parameter handling
Pass the parameters around in a structure.
Add BUFFER_BYTES argument to configure the buffer size.
Add PIPEWIRE_ALSA env variable to set format, rate, channels,
period-bytes and buffer-bytes.
Add more variables in the alsa config file.
2022-09-20 16:24:21 +02:00
Wim Taymans
0ce95e69fd pulse-server: adjust_latency should update the fragsize
Rename MAX_FRAGSIZE to MAX_BLOCK because it does not really limit the
fragsize, just the amount of data we can send in one block.

See #2711
2022-09-20 13:24:30 +02:00
Wim Taymans
3faca67ffe filter-chain: instantiate the nodes when rate is known
Instantiate the graph nodes when the samplerate is known instead of
using a fixed samplerate of 48KHz.

Warn when the convolver samplerate does not match the graph rate. We
might want to resample the IR later.
2022-09-20 11:16:51 +02:00
Wim Taymans
000a6608cf context: suspend all nodes when doing rate change
Suspend all nodes of the driver, even if the driver is already
suspended.

The suspend command makes sure that all nodes renegotiate to the new
graph rate.

This fixes the following sequence of events:

1. Play 44.1KHz file to loopback sink
2. Sink switches to 44.1, negotiates to 44.1
3. Loopback input and output streams negotiate to 44.1. All is good.
4. Stop playback, wait 5 seconds
5. Sink suspends, loopback input suspends (output stream doesn't suspend)
6. Play 48KHz file
7. Sink switches to 48, negotiates to 48. Sink (and followers) don't
   suspend because sink was already suspended.
8. loopback input negotiates to 48, output stays at 44.1 -> failure

This patch fixes step 7. where it now tries to suspend all followers
even when the driver was already suspended. This then ensures that all
followers will try to negotiate to the new driver rate.
2022-09-20 10:56:31 +02:00
Wim Taymans
6b6cd85e54 filter-chain: move debug to fastpath 2022-09-19 17:03:34 +02:00
Wim Taymans
772a12acb7 filter-chain: ref the node handle location
Use a reference to the location in the node where the handle of the
plugin can be found. That way we can change the handle only in the
node and have it changed everywhere else.
2022-09-19 15:20:59 +02:00
Wim Taymans
ac67475e64 filter-chain: move data allocation out of the link loop
The port data allocation does not depend on the links so move it
out of the loop.
2022-09-19 15:17:49 +02:00
Wim Taymans
d1cd199f16 pulse-server: set record latency as fragsize / 2
The record latency is set to fragsize / 2 by pulseaudio, so do the
same in pipewire.

Fixes #2702
2022-09-19 14:45:11 +02:00
Wim Taymans
94336cb2c9 module: use resample.prefill for coupled streams
So that we always process one complete input buffer as an output
buffer without keeping leftovers in the resampler.
2022-09-19 12:51:14 +02:00
Wim Taymans
31f9e18edb audioconvert: add resample.prefill option
Add a resampler option to prefill the resampler with 0. This then
results in the resampler always outputing and consuming the same
amount of data instead of a short buffer in the beginning.
2022-09-19 12:35:49 +02:00
Wim Taymans
d48627d0e7 module-loopback: use trigger to start processing
Move process to playback_process and use trigger from the capture
side to start processing. This ensures the requested size is updated.
2022-09-19 12:34:00 +02:00
Wim Taymans
8a39b22e25 filter-chain: use trigger to start processing
Add a process_playback function and use _trigger in the process_capture
to start processing. This ensure that the requested size is updated
before calling the process function.
2022-09-19 12:14:52 +02:00
Wim Taymans
893c5aab4d stream: update requested size before calling process
We always need to update the latest requested size for output streams
before calling process. If there are no buffers or no suggestion, let
the audioconvert make one before we try again.

This way we always get the most recent requested size.
2022-09-19 12:02:14 +02:00
Wim Taymans
aca85b49ea audioconvert: set stride on output buffers 2022-09-19 12:01:24 +02:00