Commit graph

1324 commits

Author SHA1 Message Date
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Andrea Gelmini
36ebbfa71c
Removed duplicated includes
Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2021-04-30 18:16:25 +02:00
Andrea Gelmini
f489e32e44 Fix typo in code 2021-04-30 07:40:20 +00:00
Andrea Gelmini
47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00:00
Wim Taymans
620c863b6d pulse-server: track and set monitor volume on monitor sources 2021-04-29 15:25:04 +02:00
Wim Taymans
a76032a637 client-node: use the right port for io
To set the io on the mixer ports, we need to use the same id that
was used to add the port, not the id we use to identify the mixer
structure.

Fixes #759
2021-04-28 17:04:36 +02:00
Wim Taymans
b3d94bf019 improve debug 2021-04-28 17:04:16 +02:00
Wim Taymans
3496327e69 Add echo-cancel module
Only implement the null echo cancel implementation for now.
And skeleton webrtc echo cancel implementation

It uses 4 streams arranged as:

 input ---+---> source
          ^
	  |
 sink  ---+---> output

The output of the source is the filtered input of the input stream
(linked a master source) based on the data going from sink to
the output (linked to a master sink).

All streams are arranged in the same group so that the echo canceler
does not have to deal with clock drift. For echo cancelers that can
handle clock drift we might want place the source and sink chains
in different groups.
2021-04-27 09:56:54 +02:00
Wim Taymans
27d98478ab modules: set right library variable 2021-04-26 10:45:44 +02:00
Pauli Virtanen
20c8d7b29e pulse-server: keep track of seq in pw_*_enum_params
If multiple async enum param are running at the same time, take results
only from the latest one.
2021-04-25 20:56:57 +03:00
Wim Taymans
53cd601869 pulse-server: apply node.name to all streams
Pass properties as global properties so that they are applied
to both streams. Make sure node.name is set on both streams so that
they look good in tools like carla.
2021-04-25 10:37:51 +02:00
Wim Taymans
5d104994c0 pulse-server: mark remap source and sink passive
Make sure the links to the real source/sink are passive links so that
the virtual sink is suspended with the real sink when unused.
2021-04-24 19:46:06 +02:00
Wim Taymans
962d3b9127 modules: don't add CLIENT_ID when lingering
Because the object is not destroyed when the client is destroyed
and so the client.id might become invalid.
2021-04-23 11:19:25 +02:00
Wim Taymans
d560628e2a module-loopback: copy name and description
Also copy name and description to streams when speficified globally.
2021-04-23 11:00:47 +02:00
Wim Taymans
ab7bc6ed27 pulse-server: add remap sink and source modules 2021-04-22 20:44:55 +02:00
Jonas Holmberg
1e6b7b8a83 module-protocol-native: Handle pending connect
Do not return an error immediately if connect() fails with EAGAIN. Check
if it completed successfully with getsockopt() when the socket becomes
writable instead.

This is the way to handle non-blocking connect() by the book but after
testing it seems that the case when connect() fails with EAGAIN is when
the listen backlog is full on the server side and in that case the
server socket is closed. So even though connect() completes successfully
according to getsockopt() the client socket is no longer usable
(on_remote_data() will get both SPA_IO_OUT and SPA_IO_HUP in mask on the
first call after connect() returned EAGAIN).
2021-04-22 17:46:00 +00:00
Wim Taymans
330e694e63 module-loopback: handle per stream channels and positions
Make it possible to specify different channels and positions
per stream so that we can do remapping as well.
Make sure we only copy available input channels and set the remaining
channels empty.
2021-04-22 18:38:16 +02:00
Wim Taymans
74430871fb pulse-server: implement the loopback module with module-loopback 2021-04-22 17:26:04 +02:00
Wim Taymans
115be6d5fc module-loopback: cancel pending work items when destroying 2021-04-22 17:24:59 +02:00
Wim Taymans
7d79c71178 module-loopback: parse node.latency 2021-04-22 15:46:09 +02:00
Wim Taymans
93d1c8f31d modules: improve loopback module
Handle error when loading and fix leaks.
Mark streams as virtual if nothing else is specified.
Try to reuse an existing core connection if possible.
unload the module when the core is in error or when it is destroyed.
2021-04-22 15:34:21 +02:00
Wim Taymans
3b021cc4ed modules: add module-loopback
Add a new loopback module that can also create virtual-sink and
virtual-source.
2021-04-22 13:08:20 +02:00
Wim Taymans
8294a4f42c Add vm.overrides property in pipewire and pulse-server
Apply vm.override properties when running in a VM. Increase the
default quantum to 1024 when running in a VM to cause less
dropouts.
2021-04-21 15:58:30 +02:00
Wim Taymans
fbd6a62b73 pulse-server: cancel items from work-queue
Make sure we cancel any pending work-queue items for the object before
we destroy the object.
2021-04-21 13:23:13 +02:00
Wim Taymans
639e6ea644 pulse-server: use the work-queue to unload modules
This avoids allocating an eventfd for each module.
2021-04-21 13:17:28 +02:00
Wim Taymans
fee8bf69dd pulse-server: make method to schedule module unload 2021-04-21 13:11:16 +02:00
Wim Taymans
cd224942c7 protocol-simple: use work-queue for client cleanup 2021-04-21 13:03:08 +02:00
Wim Taymans
c70a5de526 pulse-server: use a work-queue to schedule destroy
Use the context work queue to schedule destroys from callbacks.
This is better because we can pass the destroyed object around and
implement just the action we need to do on it.
2021-04-21 12:55:49 +02:00
Wim Taymans
5041c44937 link-factory: destroy lingering error links
When a link is lingering and in error, use a work queue to destroy it
automatically.
2021-04-21 12:17:53 +02:00
Wim Taymans
7031471807 pulse-server: add property to make virtual nodes
Make a property to mark virtual nodes and use it to hide the client
id from the sink-input/source-output info in pulse-server.
2021-04-20 21:05:59 +02:00
Wim Taymans
648c9b432c pulse-server: set monitor.channel-volumes=true by default
Make a null-sink with monitor.channel-volumes=true by default if not
defined otherwise. This ensures the volume of the null-sink is
always transfered to the monitor ports.

Also only set the object.linger flag when undefined.
2021-04-20 09:36:14 +02:00
Wim Taymans
575163e644 pulse-server: use args_to_audioinfo to parse channels 2021-04-19 16:49:25 +02:00
Wim Taymans
649d21ac02 pipewire-pulse: improve channels and channel_map parsing
If we have channels and channelmap, make sure they match.
If we have only channel_map, use this to derive channels instead of
taking the default number of channels and then ending up with a
mismatch.
If we have only channels, use this to generate a channelmap from
predefined maps or just unknown channels instead of taking the default
channel map.
If neither channels or channelmap is defined, use the defaults.
2021-04-19 16:41:14 +02:00
Arun Raghavan
74140abada pulse-server: Factor out module code to compile independently
This starts breaking up the giant monolith that is the pulse-server.c
code into more manageable chunks by trying to split the module code into
individual compilation units.
2021-04-15 19:37:15 -04:00
Arun Raghavan
abf193452c pulse-server: Factor out sample spec/channel parsing from modargs
This should be more broadly useful for other modules.
2021-04-15 15:55:51 -04:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans
60b405fdfd pulse-server: only send 32 channels max to a client
Limit the amount of channels we send to a client to 32 because this
is the pulseaudio limit.

This means that only the first 32 channels are accessible from the
pulseaudio API.

Fixes #1033
2021-04-14 15:29:46 +02:00
Wim Taymans
8bf7ce5fa4 pulse-server: fix channels property
Setting the channel property should create as many channels as
requested, not just the number from the default channel map.

If no channel_map is set, use the default one if the channels match
or use one with unknown channel layout otherwise.

Check the configured channels against the channel map and error
if there is a mismatch.
2021-04-14 15:29:46 +02:00
Wim Taymans
22ffed456c pulse-server: improve event handling
Do the check for the client event mask in only one place where we
are actually going to send the event. This avoids sending events to
clients that did not register them.

Rework some of the event handling when the manager emit an
add/remove/change event. Make it possible to send multiple events, like
when a sink changes, also emit a change for the monitor.

See #1042
2021-04-12 17:19:15 +02:00
Wim Taymans
af6e212817 pulse-server: add simple protocol module
Fixes #954
2021-04-12 16:17:06 +02:00
Wim Taymans
2a99e7afa8 Add simple protocol
The simple protocol listens on a socket, creates a new pw_client for
each connected client and reads/writes raw audio bytes on the
socket. Incomming bytes are copied to a playback stream, outgoing
bytes are copied from a capture pw_stream.

Fixes #954
2021-04-12 13:24:49 +02:00
Wim Taymans
d8f86ca6e5 pulse-server: make name in create_server const
constify the name in create_server() and make a copy of the name
were it is needed instead of modifying the argument in-place.
2021-04-10 11:22:41 +02:00
Wim Taymans
47bf30d734 pulse-server: create pid file only once
Only try to create the pid file once, not for every socket
we listen to.
2021-04-10 11:06:18 +02:00
Wim Taymans
225c9ebc2d pulse-server: limit the aux channels to 32
PulseAudio does not have more than 32 AUX channels so when we generate
them from unknown positions, make sure we wrap around.

See #1033
2021-04-09 19:20:46 +02:00
Wim Taymans
33ddd5f760 pulse-server: implement module-native-protocol-tcp
The module creates a tcp server on the given ip/port pair.
2021-04-09 18:27:30 +02:00
Wim Taymans
5d20f50df8 pulse-server: use the right config property 2021-04-09 11:45:06 +02:00
Wim Taymans
44e6e7f5c8 pulse-server: use PipeWire format and channel names
Use the PipeWire format and channel names in the config to avoid
confusion.
2021-04-09 11:30:57 +02:00
Wim Taymans
b305f57e4d pulse-server: make sample format and channel_map configurable
Add an entry in the config file for default format and channel map.
Use the defaults in the server_info request
Use the defaults for the default channels and map in the modules.
2021-04-09 11:12:13 +02:00
Wim Taymans
877309bfbe use priority.session to select the default sink/source
priority.session is meant to be used to set routing priorities.

priority.driver is meant to be used by the scheduler to select what
nodes is best for driving the graph. This usually depends on the
hardware quality and the use case (Pro Audio devices are likely
to be used as driving the graph).

See #1028
2021-04-08 17:48:13 +02:00
Wim Taymans
2e18d8d005 module-loopback: fix connecting to the .monitor source
When a pulseaudio clients asks to be connected to a monitor of a sink
we need to specify the sink to the session manager as the target.

Fixes #1024
2021-04-08 16:02:28 +02:00