Commit graph

2305 commits

Author SHA1 Message Date
Wim Taymans
fc68e901e5 pulse-server: don't count playing in underrun 2021-01-27 15:33:01 +01:00
Wim Taymans
47d59ac4d9 pulse-server: improve debug 2021-01-27 13:48:10 +01:00
Wim Taymans
c913abffef pulse-server: Fix underrun check
We're underrun when we can't produce the required number of samples.

See #617
2021-01-24 20:33:30 +01:00
Wim Taymans
96d98c7955 pulse-server: express latency in samples in all cases 2021-01-24 20:33:30 +01:00
Pauli Virtanen
59452a0904 pulse-server: send server change events when default nodes change
Send server change events to subscribers, when default nodes change due
to some nodes being added/removed/changed, also if there is no metadata
change.  Make sure the event is consistent with the result from
find_device at the time.

Previously, these were not necessarily sent, or information from
find_device immediately after the event might not reflect the change
yet.
2021-01-23 07:17:19 +01:00
Wim Taymans
14dcfb8a28 pulse-server: find the target device in play_sample
Use the regular logic to find the target device for play sample so
that it supports @DEFAULT_SINK@ etc.

See #612
2021-01-22 19:53:46 +01:00
Wim Taymans
652a4ae26d pulse-server: use stream flags to tune latency
Use the early_requests and adjust_latency flags to choose the right
latency values, just like what pulseaudio does.
2021-01-22 11:39:47 +01:00
Wim Taymans
486d797735 pulse-server: use rate match to feed samples
Fixes #595
2021-01-21 13:39:54 +01:00
Wim Taymans
d9af97899c pulse-server: don't destroy clients playing a sample
When a sample is playing a cached sample and it disconnects we should
wait until all the pending samples are finished otherwise we stop
their playback and get a chopped or broken sample.

See #595
2021-01-21 11:53:06 +01:00
Wim Taymans
dcc5779cd6 pulse-server: put valid volume in sample info 2021-01-21 09:42:04 +01:00
Wim Taymans
44cad2d533 pulse-server: implement suspend 2021-01-20 20:33:16 +01:00
Wim Taymans
4084db8641 module-access: Relax access check errors
Assume -EACCES is a normal thing when checking /proc/<pid>/root and
continue with just an info message. Log a warning and assume
flatpak for all other errors.

Fixes #432
2021-01-20 12:12:56 +01:00
Wim Taymans
384b8a4593 pulse-server: Only allow one memblock in the queue
Allow only one memblock in the output queue. Otherwise, if the
client is for some reason not reading from the socket, we would queue
an unlimited amount of messages until we get killed by OOM.

Change some warn to debug in the process function for things we
handle from the non-rt thread.

Fixes #488
2021-01-20 10:41:34 +01:00
Wim Taymans
96a2a2b4e2 pulse-server: Use the spa json implementation 2021-01-19 16:57:33 +01:00
Wim Taymans
0e5ad1c0a4 module-rtkit: log the dbus error as a warning 2021-01-19 15:02:37 +01:00
Wim Taymans
abfc67a3ca Revert "remove mlock and use MAP_LOCKED"
This reverts commit ab91e94b59.

When no memory can be locked, the mmap fails with -EAGAIN.

Fixes #592
2021-01-19 14:47:52 +01:00
Wim Taymans
ab91e94b59 remove mlock and use MAP_LOCKED
The warnings are confusing and a properly tuned system would have
the limits set correctly.
2021-01-19 11:59:21 +01:00
Wim Taymans
89641785c3 pulse-server: keep global free message pool 2021-01-19 11:06:00 +01:00
Wim Taymans
7e5441fbb3 pulse-server: implement stats 2021-01-19 10:52:29 +01:00
Pauli Virtanen
d46c58e958 pulse-server: behave like PA when moving streams to default
Pulseaudio unsets the preferred sink/source when stream is moved to a
default target. Emulate this behavior by setting + unsetting
target.node, which informs policy-node to move it accordingly.
2021-01-18 22:40:27 +02:00
Wim Taymans
02931df835 pulse-server: start with underrun_for = -1
PulseAudio starts with underrun_for equal to -1, sets it to 0 when
something was played and increments it from then on with the number
of bytes played.
2021-01-18 17:16:37 +01:00
Wim Taymans
55915f420e pulse-server: on underrun, pretend we read from the ringbuffer
Also update the ringbuffer read pointer on underrun.
2021-01-18 16:24:46 +01:00
Wim Taymans
6b2ec6d619 pulse-server: require at least 32 samples per buffer 2021-01-18 16:24:00 +01:00
Wim Taymans
235d25316c pulse-server: make sure we never try to ask more than tlength 2021-01-18 16:23:24 +01:00
Wim Taymans
76aff7640f pulse-server: improve variable name 2021-01-18 16:22:30 +01:00
Wim Taymans
be9c2f9757 pulse-server: account for underrun
Not quite sure, it needs more investigation but It seems the time
needs to increase when underrunning.

See #510
2021-01-17 21:07:31 +01:00
Wim Taymans
bf25fc1388 pulse-server: always use rate_match value when available
The minreq is just a fallback for when we don't know the exact
amount of required samples to consume from the ringbuffer.
2021-01-16 17:16:02 +01:00
Wim Taymans
b118a84a60 module-metadata: set factory id in properties 2021-01-14 19:22:18 +01:00
Wim Taymans
be107317f5 Silence some dbus errors
Log info when a service is not running and disable it.
2021-01-14 17:11:42 +01:00
Wim Taymans
3162465f6f portal: error->warn when the portal pid is unknown 2021-01-14 15:07:42 +01:00
Wim Taymans
4cba8fc7e9 pulse-server: implement set_sample_rate 2021-01-12 13:14:05 +01:00
Wim Taymans
219248d43e connection: guard against NULL 2021-01-12 10:13:02 +01:00
Pauli Virtanen
84ebce147a module-protocol-native: add test for reentering 2021-01-12 10:13:02 +01:00
Pauli Virtanen
23f010541f module-protocol-native: make demarshaling safe vs. reentering
The message structures returned by pw_protocol_native_connection_get_next
point to data that is contained in the buffer of the connection.

The data was invalidated when pw_protocol_native_connection_get_next was
called the next time, which made the connection loop non-reentrant, in
cases where it was re-entered from demarshal callbacks.

Fix this by allocating new buffers when reentering and stashing the old
buffers onto a stack. The returned message structure is also stored on
the stack to make lifetimes to match.
2021-01-12 10:13:02 +01:00
Wim Taymans
7ae1ea1420 pulse-server: set default channel_map
Set a default channel map when not otherwise set. Makes pulseeffects
work.
2021-01-09 12:46:00 +01:00
Wim Taymans
f94d2e7da5 pulse-server: use rate match to read from ringbuffer
Use the rate match io are to read the exact amount of samples we
need for this cycle from the ringbuffer. We can then request lower
latency.

There will also be less buffering in the audioconverter, which makes
our timestamps more accurate.
2021-01-08 17:22:15 +01:00
Wim Taymans
bad9a36a84 rtkit: set nice-level to -11 by defaukt
To mimic pulseaudio.
2021-01-05 12:33:41 +01:00
Pauli Virtanen
b76bcdc70d pulse-server: NULL means default only if id==INVALID
The default values also only apply for sources/sinks which have
defaults.
2021-01-04 23:54:48 +02:00
Wim Taymans
518365e350 pulse-server: fix module arg parsing
Parse the module arguments according to the pulseaudio syntax,
not our own syntax (which requires "" around a , delimter). Fixes
audio.position=FL,FR argument.

See #527
2021-01-04 17:25:28 +01:00
Wim Taymans
0bf7b07d91 pulse-server: improve warning 2021-01-02 20:37:44 +01:00
Wim Taymans
461e3db741 tests: fix some leaks
See #497
2020-12-21 20:07:02 +01:00
Wim Taymans
62954e14c3 node: improve profiler
Make a new complete event and use it instead of the start event
Use the start event at the start of the cycle
Make the profiler also log incomplete graph cycles
2020-12-20 20:37:21 +01:00
Wim Taymans
2d89ad8533 profiler: add xrun_count and latency to profiler 2020-12-20 12:32:54 +01:00
Wim Taymans
f7a7feea4e pipewire-pulse: use defines for our keys 2020-12-18 17:19:24 +01:00
Wim Taymans
bcceff4ab0 module-access: update with checks for fuse like upstream xdp 2020-12-18 15:48:13 +01:00
Wim Taymans
d2a5f5c1ae pulse-server: also cleanup sample when error
Remove the separate error event and merge with the done event with
error code. This then also marks the sample as done when in error
so that it gets cleaned up properly.

Fixes #486
2020-12-18 09:50:12 +01:00
Wim Taymans
1a690a0cbb pulse-server: limit writes to ringbuffer
We can't write more to the ringbuffer than its maxsize. Some clients
send more than the negotiated maxsize and cause a crash if we don't
clamp.

See #440
2020-12-17 19:39:12 +01:00
Wim Taymans
e0580fedc1 pulse-server: handle seek flags and offset
Fixes #485
2020-12-17 16:49:17 +01:00
Wim Taymans
00295b64b5 pulse-server: don't write too small buffers
Fixes #399
2020-12-11 18:09:21 +01:00
Wim Taymans
bcf6c0986e pulse-server: read in chunks of minreq from the ringbuffer
Don't read too large chunks from the ringbuffer but in minreq
increments. This is more what pulseaudio does.

Fixes #463
2020-12-11 12:45:01 +01:00