Commit graph

4704 commits

Author SHA1 Message Date
Wim Taymans
67fb792d91 pulse: only call started in READY and when not corked 2020-10-23 16:34:33 +02:00
Wim Taymans
aba02806cf mainloop: do better wallclock to rttime conversion
The mainloop time_new is supposed to be called with wallclock time
but some apps use rttime instead. Handle the case better so that we
never end up disabling the timer.
2020-10-23 16:33:05 +02:00
Wim Taymans
a5656777e0 stream: Use the control parent type as container
Some controls (channelVolumes) list themselves as Float but are stored
in an array, as can be found from the type info. Use this info to
set channelVolumes with 1 channel.

fixes some assertions like pa_pod_is_array(pod)' failed at
../pipewire/spa/include/spa/pod/iter.h:334 spa_pod_get_array()
2020-10-23 15:29:51 +02:00
Wim Taymans
c62b27ec75 pulse-server: handle under/overrun
Make sure we don't report underrun for the first time we pull data.
Send STARTED message when we leave the underrun state
Send UNDERFLOW when we enter the underrun state
Count underrun when corked.
Pass process stats back to the mainloop after process.
Decrease the pending length when we get underrun so that we can request
more data.
2020-10-23 12:59:53 +02:00
Wim Taymans
2a0828e7a2 pulse: emit sink/source changes when pending
After we get the Route update, schedule subscription events when
there are changes pending. When we scheduled a volume change ourselves,
it is likely that nothing got changed by the route update but
we still have to emit the subscription event to notify the new volume.

Fixes #298
2020-10-23 10:09:40 +02:00
Wim Taymans
ec40702427 pulse: handle NULL timespec 2020-10-23 09:52:30 +02:00
Wim Taymans
1ceb902b76 pulse-server: convert between client cubic volume and linear 2020-10-23 09:36:01 +02:00
Jan Tojnar
2e3556fa12
pulse: Add libpulse path to rpath
We are linking against PulseAudio’s libpulse,
which adds its soname to DT_NEEDED but we are expecting
to actually use our shim with the same soname from LIBPULSE_PATH
(forced by adding the path to LD_LIBRARY_PATH).

Package managers like Nix will detect that we are linking against
PulseAudio’s libpulse and mark it as a runtime dependency by adding
its path to DT_RUNPATH entry so that it can be easily found
by the loader. LD_LIBRARY_PATH will take precedence but it will still
pull PulseAudio into the system’s closure.
2020-10-23 05:36:47 +02:00
Wim Taymans
f3dda8e57b pulse: Use the right conversion functions for volumes
PulseAudio uses cubic volumes and PipeWire uses linear volumes
so use the right conversion functions from one to the other.
2020-10-22 19:34:47 +02:00
Wim Taymans
9c0ff170f9 pulse: add volume change example 2020-10-22 16:47:24 +02:00
Wim Taymans
413c233b9a mainloop: convert from wallclock to rtclock
This is needed for the mainloop timeouts
2020-10-22 16:46:29 +02:00
Wim Taymans
70e9e622eb jack: declare constants like jack does again 2020-10-22 15:23:56 +02:00
Jan Grulich
743cf58fb7 Define SPA_FALLTHROUGH to make fall-through annotations work for all compilers
This is needed for example for Clang compiler which uses different
annotations than GCC. It will make WebRTC to happily use PipeWire
since the spa library is header-only and WebRTC defaults to use
Clang with -Wimplicit-fallthrough.
2020-10-22 13:31:19 +02:00
Max Jöhnk
406b99c4c5 context: fix @DEFAULT_SOURCE@ wildcard 2020-10-22 11:23:17 +00:00
Wim Taymans
4450ddadcf pulse: mark the global changed when volume/mute changed
When we change the volume/mute of a sink/source, mark the source
as changed so that when we get the update from the server we
emit a CHANGE event. We don't do this otherwise because the server
volume update and our local volume is the same.

Fixes #298
2020-10-22 13:18:09 +02:00
Wim Taymans
55b4042512 context: support foreign mainloop_api
Detect if the mainloop_api is one of ours and use the loop directly in
that case. Otherwise, make a new loop and add the fd to the foreign
mainloop_api. Make sure we clean up as well.

Fixes #345
2020-10-22 12:26:27 +02:00
Wim Taymans
7782352e8d context: track changes more closely
Mark the global changes and only emit a change event when
something changed.
2020-10-22 11:03:27 +02:00
Wim Taymans
2dee35c216 context: improve debug 2020-10-22 11:02:57 +02:00
Wim Taymans
5e325f636c impl: use _ALL change_mask for everything
Instead of ~0
2020-10-22 10:59:04 +02:00
Wim Taymans
723ebcf438 protocol-native: only send properties when in change_mask
Only send the properties when the change mask includes them.
This reduces the message size.
2020-10-22 10:57:43 +02:00
Wim Taymans
c1ea63fa7a alsa-pcm: try to recover in all cases
Even if we can't get the current status, still try to recover the
device.

See #347
2020-10-22 09:16:45 +02:00
Wim Taymans
398dc3055b context: improve profile parsing
First parse the profile into a strv so that we have a copy of the
profiles and it can't change when the original string (in properties
or environment) gets changed.

See #345
2020-10-21 18:09:34 +02:00
Wim Taymans
2193d03eab pulse-server: handle the case with record from monitor
Also handle the case where the client asks to record from the monitor
source directly.
2020-10-21 17:09:15 +02:00
Wim Taymans
d55bc1eb86 keys: add PW_KEY_STREAM_CAPTURE_SINK
Add a property for capture stream to signal that they would like
to capture the output (monitor) of the default sink instead of the
default source.
Check the desired device we would like to capture from and handle
the capture from the sink by monitoring the monitor source.
2020-10-21 17:00:49 +02:00
Wim Taymans
37b39135e9 pulse-server: improve find device by name
Also find the device by name if the name contains a string of the
index.
2020-10-21 16:38:30 +02:00
Wim Taymans
a2c70781a3 media-session: use rtkit for session manager data thread 2020-10-21 16:36:37 +02:00
Wim Taymans
25e4f2088c policy-node: also handle the single stream move 2020-10-21 15:39:37 +02:00
Wim Taymans
bfac6f04db policy-node: avoid rescan when moving a node
When we are moving a node, the node becomes unlinked temporarily.
Make sure the rescan code doesn't try to link it to a node
meanwhile.

Fixes #344
2020-10-21 15:27:50 +02:00
Wim Taymans
71c760de14 pulse: fix cleanup of the stream
When the pa_stream is destroyed we need to remove it from the
global, if any (and not when the pw_stream is destroyed).

Fixes crash in gnome-control-center when switching sinks.

See #343
2020-10-21 15:05:41 +02:00
Gleb Popov
fc18a8ffbd Fix build on FreeBSD. 2020-10-21 11:33:16 +00:00
Wim Taymans
64913f4c7c protocol-native: ref the client while emiting error
Increase the client refcount while we emit an error to make sure
it doesn't get destroyed in the callbacks.

See #340
2020-10-21 13:25:00 +02:00
Wim Taymans
48d1b8d57d pulse-server: fix property key remove 2020-10-21 12:03:45 +02:00
Wim Taymans
66173e4257 pulse-server: refactor stream property fixup 2020-10-21 12:03:13 +02:00
Wim Taymans
ee3298137b pulse-server: fix some allocation errors 2020-10-21 12:02:42 +02:00
Wim Taymans
d6391070c4 pulse-server: use property keys 2020-10-21 12:01:40 +02:00
Wim Taymans
bc1192c8dd pulse-server: handle message errors 2020-10-21 12:00:25 +02:00
Wim Taymans
bb8bd3d76d pw-cat: don't put empty strings in metadata 2020-10-21 11:03:36 +02:00
Wim Taymans
4e3af9d122 pulse-server: support @DEFAULT_*@ wildcard in names 2020-10-21 10:55:14 +02:00
Wim Taymans
5f482b287e pulse: first signal READY, then cork if still needed 2020-10-21 10:42:29 +02:00
Wim Taymans
1af41254af pulse: set state to READY after format
Always start ACTIVE so that negotiation can happen.
When we get a format, calculate and update the latency, cork if needed
and then go to the READY state.

This is more in line with what pulse does and should improve
compatibility.

See #341
2020-10-21 10:28:18 +02:00
Frédéric Danis
48c64f9084 bluez5: backend-hsphfpd: Fix PCM agent name
The audio agent gets or provides data in the format requested between host
and chipset.
The HSP and HFP profile request PCM data to be sent to the chipset which
will encode/decode them in CVSD format.
This audio agent format may be re-used later for another air codec hw
encoded.
So, rename the audio agent to be more explicit.
2020-10-20 19:10:21 +00:00
Frank Praznik
62a34f8c48 defs: rename variables in min/max macros
Fixes a variable shadow warning when SPA_CLAMP() is used.
2020-10-20 19:08:25 +00:00
Frank Praznik
796db2b11b builder: fix variable shadow warning 2020-10-20 19:08:25 +00:00
Wim Taymans
4818795d31 pw-cat: set media.filename 2020-10-20 17:16:33 +02:00
Wim Taymans
74eaf5a2ca pw-cat: parse metadata and make a nice media.name if possible 2020-10-20 17:11:00 +02:00
Wim Taymans
ff99a48acf pulse-server: prebuf can be 0 2020-10-20 16:44:08 +02:00
Wim Taymans
d3ee29caff pulse-server: fix format names 2020-10-20 16:39:31 +02:00
Wim Taymans
5b32125d44 pulse-server: handle format_info
Parse the format_info in CREATE_STREAM and use this to negotiate
the stream. Implement channel_map parsing.
Delay setting up the buffer attributes until we have negotiated a
format.

Makes GStreamer pulsesink work (rhythmbox,... )
2020-10-20 16:25:47 +02:00
Wim Taymans
aea7ace124 pulse-server: keep track of requested bytes
Keep track of the amount of bytes we already requested from the client
and don't ask for those again.

Fixes initial hickups in firefox and others.
2020-10-20 15:57:18 +02:00
Wim Taymans
9abc7993e1 pulse-server: fix props update 2020-10-20 13:18:54 +02:00