Commit graph

318 commits

Author SHA1 Message Date
Wim Taymans
346e35eed5 deprecate the libpulse replacement
Don't build by default, update the README
With pulse-server we are more flexible and compatible and we don't
have to (badly) reimplement libpulse anymore.
2020-11-12 15:18:04 +01:00
Wim Taymans
1570e62635 remove hooks from objects
Remove the hooks we installed on objects in the destroy/free event
or before calling _destroy. This is not really needed but it is
a nice thing to do because it calls the hook removed callbacks.
2020-11-06 15:53:32 +01:00
Wim Taymans
6444147a12 pulse: protect context
Make sure the context is READY when calling function
Protect pa_operation_sync against disconnected context

Fixes #365
2020-11-04 19:27:17 +01:00
Wim Taymans
7a43769648 pulse: guard against NULL core
See #365
2020-11-04 17:41:40 +01:00
Wim Taymans
b59eff4c29 pulse: handle EINTR from the custom poll function 2020-11-02 16:45:49 +01:00
Wim Taymans
c43026d93e don't handle EINTR and EAGAIN as the same
EAGAIN means a non-blocking operation would block and we should not
try again right away but leave the loop and wait instead.

See #358
2020-11-02 16:43:56 +01:00
Wim Taymans
e094640c7b handle EINTR and EAGAIN
Just do the call again instead of failing or logging an error.

Fixes #358
2020-11-02 14:51:07 +01:00
Wim Taymans
0265514023 pulse: avoid blocking in epoll
When the custom poll function told us there is activity on the
epoll fd, don't do a blocking wait on the epoll fd. It might be
possible that the active fd is removed and then we would block
forever.

Fixes #349
2020-10-29 15:56:22 +01:00
Wim Taymans
893873b69e introspect: clear port info 2020-10-28 11:10:35 +01:00
Wim Taymans
acfb48e3da pulse: improve debug 2020-10-27 16:46:12 +01:00
Wim Taymans
f75acc31d3 pulse: remove unused array 2020-10-26 13:28:01 +01:00
Wim Taymans
8ac9ce7947 pulse: avoid node lookup when connecting
We can use the node name directly if we strip the .monitor suffix
or remove the MONITOR flag form the name/id.
2020-10-24 16:58:01 +02:00
Wim Taymans
ec860d64cf Revert "pulse: we can pass the device name directly in NODE_TARGET now"
This reverts commit fc6a729c57.

Pulse passes either the monitor id or the sink.monitor name, which
are not known to the session manager.
2020-10-24 16:27:31 +02:00
Wim Taymans
fc6a729c57 pulse: we can pass the device name directly in NODE_TARGET now 2020-10-24 16:09:28 +02:00
Wim Taymans
3255bc8eae context: use clock time as rttime when using our loop 2020-10-23 20:37:04 +02:00
Wim Taymans
520c2a0e16 context: only go to READY after registry is loaded
This way we can lookup the node name when connecting a stream.

See !314
2020-10-23 18:23:02 +02:00
Wim Taymans
cced538901 context: don't leak formats 2020-10-23 18:20:50 +02:00
Wim Taymans
617afee62b pulse: return NULL format in error 2020-10-23 18:08:09 +02:00
Wim Taymans
732bf4b58c context: protect against bad context state
Avoid crash in firefox when daemon is stopped.
2020-10-23 17:10:19 +02:00
Wim Taymans
42e60b66f3 pulse: uncork stream when draining 2020-10-23 16:34:52 +02:00
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
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
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
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
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
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
Wim Taymans
42fde7e00d introspect: always have an active port 2020-10-19 17:59:53 +02:00
Wim Taymans
47680ffade pulse: disable rtkit in the client
It can cause SIGKILL and crash the compositor
2020-10-19 17:23:07 +02:00
Wim Taymans
aaffda9d17 pulse: small cleanup 2020-10-19 09:31:54 +02:00
Wim Taymans
56f84ce0e4 pulse: add more debug info 2020-10-15 16:08:25 +02:00
Wim Taymans
1bd31c1cf1 don't force a MEDIA_ROLE property
The application has to set a media role.
2020-10-14 12:11:35 +02:00
Wim Taymans
6469663265 pulse: only report suspended when not corked
We only want to be in the suspended state when we are paused bu didn't
cork ourselves.

See #300
2020-10-13 20:54:39 +02:00
Wim Taymans
421a15939d pulse: clear global on the stream when destroyed 2020-10-13 10:19:02 +02:00
Wim Taymans
1d95b5bb5b pulse: fix fragsize initialization 2020-10-07 12:00:31 +02:00
Wim Taymans
d027a02223 pulse: ask up to tlength bytes
pulseaudio does not ask more than this as well.
2020-10-05 17:13:42 +02:00
Wim Taymans
6f6dc8b63e pulse: set stream READY after it is linked
Wait until we have linked the stream to a device or stream before
we emit the READY state. This is what pulseaudio expects.

Remove stream_index from disconnecting stream so that we don't
accidentally use it again. It is possible that we already created a
new stream with the same id before the old stream could complete the
disconnect.
2020-10-05 12:16:49 +02:00
Wim Taymans
ac4d4582a4 pulse: set mask after completing the operation
This ensures we first finish all pending operations and then get
notifications of the new events. Brings pactl subscribe in line
with what it does on real PulseAudio.
2020-09-30 10:16:20 +02:00
Wim Taymans
19c9a55050 pulse: first sync globals, then try operations
First sync the globals and if no global created new pending operations,
run through the operations. This ensures no operation is run before
all globals have data.
2020-09-30 10:14:44 +02:00
Wim Taymans
60df925dfd pulse: set monitor as device.class for monitor sources 2020-09-30 10:14:04 +02:00