Commit graph

844 commits

Author SHA1 Message Date
Wim Taymans
1ea8282a24 pulse-server: don't update ringbuffer in underrun 2021-01-29 10:45:26 +01:00
Wim Taymans
f8d57d03ca pulse-server: keep separate counter for missing bytes
And only increment when consumed from ringbuffer. In underrun we
play silence and don't ask for the missing bytes.

Fixes #616
2021-01-28 20:00:48 +01:00
Wim Taymans
09f423922d pulse-server: don't crash when alloc fails 2021-01-28 19:30:32 +01:00
Wim Taymans
8636c509f5 pulser-server: revert attempt to flush more
size is later used as the buffer size and might be too large.
2021-01-28 19:17:50 +01:00
Wim Taymans
b65b291bb2 pulse-server: make sure to count played samples
On underrun we need to keep on counting playing_for so fill this
in underrun and don't add this to missing to avoid double counting.

See #639
2021-01-28 18:59:03 +01:00
Wim Taymans
ac3555d6fc pulse-server: skip underrun more aggressively
Skip all of the underrun bytes immediately.

See #638
2021-01-28 17:56:32 +01:00
Wim Taymans
e172effe71 pulse-server: log the amount of underrun bytes 2021-01-28 17:56:07 +01:00
Nicolai Syvertsen
ebcdfe8f5d pipewire-pulse: better default null sink description
This includes the sink_name and media class.
2021-01-27 19:09:21 +01:00
Nicolai Syvertsen
c092f0c1c4 pipewire-pulse: null sink must have a description
Certain pulseaudio clients crash if this is unset
2021-01-27 15:31:54 +00:00
Wim Taymans
0be851739f improve config parsing
Use get_string to get object keys in a more generic way.
2021-01-27 15:36:32 +01:00
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
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
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
4cba8fc7e9 pulse-server: implement set_sample_rate 2021-01-12 13:14:05 +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
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
f7a7feea4e pipewire-pulse: use defines for our keys 2020-12-18 17:19:24 +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
Wim Taymans
d3db703f77 pulse-server: improve some debug 2020-12-11 12:39:46 +01:00
Wim Taymans
4ef0ef464e pulse-server: warn for unsupported seek flags 2020-12-11 10:39:15 +01:00
Wim Taymans
5469ac19ab pulse-server: map node.description to device.description
Makes Teamspeak work

Fixes #462
2020-12-08 12:20:47 +01:00
Wim Taymans
5a94bfc6cd pulse-server: add some more supported channel_map values 2020-12-07 21:52:09 +01:00
Wim Taymans
157d6de607 pulse-server: convert channel_map channels
channel_map contains pulseaudio channel names, convert them to
pipewire channel ids and then into pipewire channel names for the
null sink.
2020-12-07 20:29:22 +01:00