Commit graph

4092 commits

Author SHA1 Message Date
Wim Taymans 0573944e59 raop: add authentication 2021-11-13 10:00:50 +01:00
Wim Taymans 5d6690ebe7 raop: only encrypt when enabled 2021-11-12 18:10:39 +01:00
Wim Taymans 4695bd32c4 raop: move some info to debug 2021-11-12 17:56:04 +01:00
Wim Taymans 6ce9260980 pulse-server: implement module-raop-discover 2021-11-12 17:53:24 +01:00
Wim Taymans fa1f556d93 module-raop-sink: handle 0 block_size 2021-11-12 16:58:27 +01:00
Wim Taymans ac92f584ab raop: remove duplicate define 2021-11-12 16:58:27 +01:00
Wim Taymans 7ed9c790e2 raop: More improvements
Handle control source io. We don't yet implement retransmission,
though.
Handle latency by exposing the server latency on the stream ports.
Use the Format param event to connect/announce and teardown.
Use the stream state to record/flush.
Fix some leaks.
Remove the state from rtsp-client, we don't need it.
Strip whitespace from header values.
2021-11-12 16:58:27 +01:00
Wim Taymans 27bc5e9ae5 raop: more improvements
Create sync and timing packets, reply to timing requests.
Send the right amount of data.
Parse protocol/encryption/codec parameters and use them.
2021-11-12 16:58:27 +01:00
Wim Taymans 9223fc2885 raop: add beginnings of RAOP protocol 2021-11-12 16:58:27 +01:00
KangJing Huang (Chaserhkj) c21536eec8 module-echo-cancel: Remove intelligibility param with no effect 2021-11-11 16:52:58 +00:00
KangJing Huang (Chaserhkj) a9a0b0466a module-echo-cancel: wireup voice detection 2021-11-11 16:52:58 +00:00
Jonas Ådahl 15b4c58e80 gst: Don't ask for DMA buffers
Gstreamer simply mmap()s the DMA buffers. This can be very very slow on
some hardware, so don't ask for it. For gstreamer to support DMA
buffers, it will need to support a proper way of transferring the
buffers from the GPU to the CPU, e.g. using EGL/OpenGL.
2021-11-11 10:22:37 +00:00
Peter Hutterer 671410b3bf pw-mon: add support for colored output
Same CLI as pw-dump, i.e. -N, --no-colors, --color=always etc are
supported.

This uses a for-loop macro hack to automatically print prefixes and
suffixes, the with_prefix() macro resolves into the correct printf
statements to insert either just the marker "*" or the ansi sequences
for color/reset. Use of the macro is simply:
```
   with_prefix(true, stderr) {
	fprintf(stderr, "this will be prefixed\n");
   }
```
2021-11-11 08:21:58 +00:00
Peter Hutterer cafe94efc2 pw-mon: switch the changed marker from single char to string
Prep work for coloured output where the prefix/suffix may be multiple
characters if ANSI sequences are used.
2021-11-11 08:21:58 +00:00
Peter Hutterer 2531ab0acd pw-mon: switch to use stderr everywhere
Most of pwmon's output uses spa_debug() or some related helper which
prints to stderr. Let's switch our explicit printfs over so we can
redirect the whole thing in one go.
2021-11-11 08:21:58 +00:00
columbarius 06b0512b22 examples: video-play-fixate.c add fallback for older PipeWire versions
The posibility to drop single modifier was added in this development
circle (after 0.3.39 release). To have clients work with older versions
of PipeWire dropping all modifiers can be an option.
2021-11-10 22:23:30 +00:00
columbarius 1c922958bc examples: video-src-fixate.c cleanup example
Cleanup printed messages and rename memfd.
2021-11-10 22:23:30 +00:00
columbarius ed3be2114c examples: video-play-fixate.c remove fixated check 2021-11-10 22:23:30 +00:00
Nicolai Syvertsen a84cfac28a Only handle -EPIPE eerrors. 2021-11-10 19:26:03 +00:00
Nicolai Syvertsen 7b773433f4 pipewire-pulse: add manager disconnect event
Drop client connections when pipewire goes away. pipewire-pulse daemon can remain running and pulseaudio clients will be able to connect again once pipewire is up and running.
2021-11-10 19:26:03 +00:00
Barnabás Pőcze df3ea8dafa pipewire: module-profiler: destroy event source
Even though all event sources are kept in a list in the current
implementation of the event loop in the SPA support plugin, relying
on it freeing all sources could lead to unbounded memory use
if the profiler module is loaded and unloaded over and over again.
2021-11-10 14:05:35 +00:00
Barnabás Pőcze d4e4b5df98 pipewire: module-profiler: handle global's destroy event
Handle if the global is destroyed (e.g. `pw-cli destroy X`) to
avoid a use-after-free in `pw_global_destroy()` when it is called
with a dangling pointer from `module_destroy()`.
2021-11-10 14:05:35 +00:00
Barnabás Pőcze 336e4d5f03 pipewire: module-echo-cancel: aec-webrtc: use unique_ptr
Use `std::unique_ptr<>` to clean up memory in the destructor
instead of manually freeing resources in the destroy callback
and error code paths.
2021-11-09 22:27:31 +01:00
Barnabás Pőcze 5896083545 pipewire: module-echo-cancel: aec-webrtc: use appropriate casts
Use the suitable C++ cast instead of C-style casts.
2021-11-09 22:27:03 +01:00
Barnabás Pőcze 144face6ad pipewire: module-echo-cancel: aec-webrtc: use getters with default
Instead of get-check-parse, use `pw_properties_get_bool()`
which does all three in one convenient function.
2021-11-09 22:27:01 +01:00
Barnabás Pőcze 175efc4c1d pipewire: module-echo-cancel: avoid extra allocation
Use `pw_properties_setf()` instead of `calloc()` +
`sprintf()` + `pw_properties_set()` + `free()`.

Furthermore, check the return value of `sscanf()`.
2021-11-09 22:02:55 +01:00
Wim Taymans c9fc3d7f42 pulse-server: don't process while the stream is created
When the stream is still being created, avoid doing any processing
because some things might not be configured yet.
2021-11-09 16:29:46 +01:00
Wim Taymans daf761a87f utils: export pw_getrandom
Export the symbol and move it to utils.
2021-11-09 16:16:30 +01:00
Wim Taymans 62509f23d7 impl-core: pass data to listener user_data
So that we can get to the registry resource.
2021-11-08 12:56:00 +01:00
Wim Taymans 5ed4977b38 destroy proxies when global is removed
When a global is removed, also remove the proxies. We can have multiple
proxies to a global otherwise when a client has a sequence of events
queued from the server like this:

Global 1 added
Global 1 removed
Global 1 added

The proxy we added in the firt event would not be destroyed because the
server did not know about it when global 1 was removed and then a
second one would be made.
2021-11-08 12:55:41 +01:00
KangJing Huang (Chaserhkj) bb407e8153 Wire up webrtc aec parameters to args 2021-11-06 05:20:33 -04:00
Wim Taymans 743f699193 pulse-server: try to not put pointers in info messages
It's not very helpful, prefer to use human readable strings and move the
more techincal stuff in debug messages.
2021-11-05 16:22:22 +01:00
Wim Taymans 2f3e65c049 pulse-server: leave the draining state
Use pw_stream_set_active() to leave the draining state so that our
process methods are called again and we can resume.
2021-11-05 15:47:49 +01:00
Wim Taymans 90fe579b29 stream: make _set_active(true) leave the draining state
If the stream is drained, make _set_active(true) leave the draining
state so that the process() events are emitted again and buffers will
be pushed().
2021-11-05 15:45:55 +01:00
Wim Taymans 0cccff517b pulse-server: send the drained event only once
Only send the drained command once. pw-stream keeps on emitting drained
events as longs as the stream is drained.
2021-11-05 15:42:33 +01:00
Wim Taymans 6ca297797f pulse-server: ensure latency is multiple of frame_size 2021-11-05 13:31:09 +01:00
Wim Taymans b96f15d2fe pulse-server: improve latency setup a little
Reorganize the latency setup in one place, return a desired device
latency for use as quantum.

PulseAudio assigns half of the (tlength - minreq) latency to the sink
but we can't do that because our sinks have a max-quantum of latency.
Fix this by clamping our calculated sink latency to the quantum

PulseAudio subtracts the sink latency from the tlength in adjust latency
mode, so we need to do the same.

This makes PULSE_LATENCY_MSEC values bahave more like pulseaudio.

See #1769
2021-11-04 18:07:30 +01:00
Wim Taymans 86ca0f8466 acp: improve debug of channel map
Increase the size of the channel_map debug printf buffer.
Use a safer version of the snprintf that avoids buffer overruns.

See #1781
2021-11-04 16:41:32 +01:00
Wim Taymans efd8ac25e3 pulse-server: don't emit _removed without havine emitted _added
Don't emit _removed for objects that are still being created because
we did not emit an _added signal for them yet.
2021-11-04 12:50:18 +01:00
Wim Taymans b0e3e43c42 pw-mon: destroy proxies in global_remove event
Keep track of the proxies and remove them when the global is removed.
Otherwise we might end up in a case where the have 2 proxies when
an add/remove/add sequence of messages was queued.
2021-11-03 17:25:11 +01:00
Wim Taymans f70fdf5605 pulse-server: also remove creating objects
When an object is created, it is marked creating until all roundtrips
complete. If the object is removed in between, we don't remove it
because find_object does not return creating objects.

Make find_object also return the creating objects to fix this.
2021-11-03 16:57:41 +01:00
Wim Taymans 73bf30efa6 module-zeroconf: translate audio format
The audio format in the avahi messages is in pulseaudio format so
translate it to PipeWire format in audio.format.

See #1745
2021-11-03 12:54:58 +01:00
Thomas Weißschuh 7d9b49293c core: add runtime fallback for nonpresent getrandom() sycall
The current compile-time-check only tests for the getrandom() syscall
wrapper of libc. The presence of this wrapper however does not relate to
the presence of the actual syscall at runtime.
2021-11-02 17:55:24 +01:00
Pauli Virtanen bbc2136e89 meson: ensure all examples are included in doc
Move declaration of examples to use same file lists for build and docs.
2021-11-02 09:46:14 +00:00
Wim Taymans 3c8a60944f pipewire: handle NULL plugin_dir
We can't load plugins when the plugin directory is unspecified, either
in config.h or with SPA_PLUGING_DIR in the environment.

Fixes #1774
2021-11-02 09:18:42 +01:00
Wim Taymans 9facfca45b jack: add option to disable monitor ports
Add a jack.show-monitor option (default true) that makes it possible
to hide the monitor ports.

Monitor ports are not enabled by default on JACK and maybe they also
should not for PipeWire. Or maybe we need some tweaks for some apps.

See #1760
2021-10-29 09:27:46 +02:00
Wim Taymans f39f9b207b map: don't mix insert_at() and _remove()
You are supposed to allocate with _insert_new()/_remove() or use
someone elses allocated number with _insert_at(), never mix the
two or it will give an error.
2021-10-28 09:36:41 +02:00
Simon McVittie f6b1d65e35 core: Use /dev/urandom for getrandom fallback
Sami Farin pointed out on #833 that on Linux kernels older than 5.6,
/dev/random blocks when entropy estimates are too low, whereas
/dev/urandom does not.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-28 07:15:50 +00:00
Wim Taymans 3509962f3a module-session-manager: don't leak the impl structure
We need to remove the listener for the object as well so that we
can safely free the impl memory.
2021-10-27 17:41:32 +02:00
Wim Taymans 2112a7287b tests: add new ABI test for stream 2021-10-27 11:31:39 +02:00
Wim Taymans a84e43e3ee examples: update some examples with RequestProcess
Let video-src unconditionally call _trigger_process() when it is
ready. This will either start the graph when it is the driver or emit
a RequestProcess event to the driver.

Let video-play-pull intercept the RequestProcess command and use it
to do a trigger_process(). Otherwise use a timer to pull in the next
frame.
2021-10-27 11:20:06 +02:00
Wim Taymans baca092ba5 stream: emit the RequestProcess event
Emit the RequestProcess event when pw_stream_trigger_process() was
called but we are not the driver node.

Fixes #1728
2021-10-27 11:19:56 +02:00
Wim Taymans b5080a0395 node: dispatch RequestProcess event and command
The event is send to the driver node.
The command is sent to node directly.
2021-10-27 11:16:53 +02:00
Wim Taymans 7529e7c47c stream: add trigger_done event
It is emited after the graph cycle that was started with
trigger_process() completed.
2021-10-27 11:15:29 +02:00
Wim Taymans 0982c903eb fix example a little 2021-10-27 11:09:24 +02:00
columbarius 110aac8c6f examples: video-play-fixate announce ParamBuffer after fixation
This lets the fixation finish. Can this be made unneeded?
2021-10-27 11:09:24 +02:00
columbarius 9f34885174 examples: Create source and sink with fixation on format negotiation
This commit uses the video-src-alloc and video-play-reneg templates to create
examples for manual fixation at the format negotiation phase. These
clients simulate modifier negotiation done by clients handling DmaBufs.

Note: Neither client is capable of proper DmaBuf handling!

video-play-fixate can be used to test if a producer is capable to
fallback to shm buffer transport, while video-src-fixate can only be
used with the former example!
2021-10-27 11:09:24 +02:00
Wim Taymans 0568958856 impl-link: keep on negotiatiating until fixed Format
Send unfixed Format to nodes but don't proceed to the next state.
When EnumFormat is emited, change the link state back to INIT to restart
the negotiation.

Fixes #1732
2021-10-27 11:09:07 +02:00
Tom Briden 6cea8b201b meson: Allow session-managers option to be an absolute path
If it's not an absolute_path, then set the build_ms and build_wp
as normal, otherwise use the value as passed in.
2021-10-27 08:27:53 +00:00
Simon McVittie e167123667 Reinstate compatibility with older Linux with no getrandom()
Commit 42d8b2b1 "Remove legacy FreeBSD compatibility code" removed
compatibility with old versions of FreeBSD, but also removed
compatibility with old versions of Linux and glibc, which was requested
in #833.

This partially reverts commit 42d8b2b167.

Resolves: #833
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-26 19:32:02 +01:00
Wim Taymans a2f06be199 pulse-server: Improve combine sink properties
Make streams and sink have the same description so that they show
up as the same node in catia.
2021-10-26 10:50:28 +02:00
Wim Taymans 33653cbabf protocol-pulse: flush streams on pause
To remove any lingering data
2021-10-26 10:49:50 +02:00
Wim Taymans ba18768246 impl-link: both ports need to be negotiated before we can allocate
Fix allocation check. Both ports need to be at least negotiated before
we can attempt to allocate buffers.
2021-10-26 10:13:21 +02:00
Peter Hutterer 9acee530e2 meson: switch to "foo in array" style for meson arrays
In Meson, string.contains() is a substring check but array.contains() is
a full string check. Let's use 'foo in bar' style instead to avoid
confusion.

Supported since meson 0.49.0
2021-10-26 06:22:20 +00:00
Wim Taymans c4d5c01429 impl-link: check port state before allocating
At least one port needs to be ready to do allocation.
2021-10-25 18:13:47 +02:00
Wim Taymans f9a45a8b84 impl-link: improve debug 2021-10-25 18:12:24 +02:00
Wim Taymans f7eafe1404 stream: use user param field to track param changes
count the number of changes and then when there are any, flip the
SERIAL bit in the param info so that the server can detect a
change. Without this, 2 updated params would not flip the bit and the
param changes would not be noticed.
2021-10-25 18:08:58 +02:00
Wim Taymans 5dfc3494dc map: use uintptr_t for the next pointer
This aligns the low bits of the next field with the low bits of the
pointer on big endian cpus.

Fixes #1747
2021-10-25 16:17:35 +02:00
Wim Taymans c07f0ccb71 map: make _insert_at() fail on a removed item
You are only supposed to use _insert_new()/_remove() or _insert_at()
on the map, If we detect a _insert_at() to a removed item,
return an error because else we might corrupt the free list.

Update unit test accordingly.
2021-10-25 16:17:35 +02:00
Peter Hutterer d5825b8551 meson: use meson variables for the SMs' uninstalled scripts
Both wireplumber and media-session have a meson variable now that
represents the -uninstalled script, complete with filled-in BUILDDIR
etc.

Let's use those variables for pipewire-uninstalled.conf so we don't have
to fill in the paths here.
2021-10-25 07:45:56 +00:00
Philippe Normand 397a67889a examples: Add explicit break statement in video-play-reneg 2021-10-25 07:26:15 +00:00
Guilherme Henrique 8641977816 meson: Set session manager variable based on renamed project 2021-10-24 19:53:02 +02:00
Gleb Popov 65aea7c05a Avoid compiler warning by #ifdef'ing a function used only on Linux. 2021-10-22 19:08:24 +03:00
Gleb Popov a76ccfe64b Set PW_KEY_SEC_LABEL property on FreeBSD and avoid compiler warning. 2021-10-22 19:07:45 +03:00
Gleb Popov 43ef614537 Remove unused function. 2021-10-22 19:05:43 +03:00
Gleb Popov e26b40a75f Fix compiler warning by spelling the initializer properly. 2021-10-22 19:04:47 +03:00
Wim Taymans e1f21ebd0b stream: add spa command include 2021-10-20 11:51:50 +02:00
Wim Taymans 45d9c2c9df pw-cat: use default metadata for default source/sink 2021-10-20 11:40:33 +02:00
Peter Hutterer 6edbbf6a23 examples: fix NAME for bluez-session 2021-10-20 08:55:27 +00:00
KangJing Huang (Chaserhkj) 22aad6eaff Tuning some webrtc parameters 2021-10-19 18:59:07 +00:00
KangJing Huang (Chaserhkj) 2bfc03f43c Allow echo-cancel to select larger buffer sizes 2021-10-19 18:59:07 +00:00
Wim Taymans 002566ae83 test: fix stream ABI test 2021-10-19 17:16:25 +02:00
Wim Taymans 34609389e3 filter: add event to notify command
All commands send to the filter are emited in the command event.
2021-10-19 15:27:14 +02:00
Wim Taymans dfa3f631ec stream: add event to notify commands 2021-10-19 15:23:20 +02:00
Wim Taymans 100c12460f client-node: handle events, send them to the server part 2021-10-19 12:28:23 +02:00
Wim Taymans b4dc04c777 stream: use sizeof instead of hardcoded value 2021-10-19 12:26:02 +02:00
Wim Taymans b6059fd007 stream: add some debug for commands 2021-10-19 12:25:46 +02:00
Wim Taymans 32c7121e54 impl-node: add method to send a command to a node 2021-10-19 12:24:47 +02:00
Barnabás Pőcze 4c27c3fd43 pulse-server: use for-each loop
Use `SPA_FOR_EACH_ELEMENT` to enumate the elements
in the array instead of an "indexed" loop.
2021-10-18 15:36:22 +02:00
Barnabás Pőcze 3fefb55ef2 pulse-server: return NULL instead of 0
... to be consistent with the vast majority of the
existing source code.
2021-10-18 15:36:22 +02:00
Barnabás Pőcze ee7b82ac9e pulse-server: remove unnecessary NULL check
`spa_streq()` already checks for NULL pointers, so the
pointer does not need to be checked before calling it.
2021-10-18 15:36:22 +02:00
Barnabás Pőcze 80ae688cc6 pulse-server: compile extensions separately
Avoid including other C source files. Compile them separately.
2021-10-18 15:36:17 +02:00
Peter Hutterer b78371f702 tools: update pw-reserve so don't need to include the c file 2021-10-18 20:44:11 +10:00
Peter Hutterer 1bced6b2ef Remove media-session from this tree
It is now available as a separate project in
https://gitlab.freedesktop.org/pipewire/media-session

The code required by pw-reservice has moved to src/tools/reserve.{c|h}
2021-10-18 20:44:07 +10:00
Wim Taymans bd8ec29bb5 link-factory: avoid using 0 for invalid id
Use SPA_ID_INVALID instead of 0 when we fail to parse the port id
so that we don't accidentally match an internal port id.

See #1724
2021-10-18 11:35:25 +02:00
Peter Hutterer dfb63d55dd media-session: use the SESSION_PREFIX for any fallback config dir
Regression introduced in 3560f3ba2d

MEDIA_SESSION_CONFIG_PATH expects the actual directory while
PIPEWIRE_CONFIG_PATH and the built-in fallback both expect the files to
reside within the SESSION_PREFIX subdirectory.

Fixes #1725
2021-10-18 07:23:00 +00:00
Peter Hutterer 56f01a293c media-session: fix config load path
config_dir is the new MEDIA_SESSION_CONFIG_DIR environment variable (if
set), impl.config_dir is that or the fallback, whichever applies.

Fixes 00bd3b5b59
Fixes #1725
2021-10-18 07:23:00 +00:00
Wim Taymans e1deecc3cd impl-link: also update node id in properties
The link might have been made using the node name/nick/description but
we always want to place the id in the properties to make it easier for
apps to handle the relations between objects.

See #1723
2021-10-15 17:58:05 +02:00
Peter Hutterer 00bd3b5b59 media-session: store the config dir path in our object
The media session modules need to load config files through
sm_media_session_load_conf() and that must be the same config dir as our
main configuration file's directory.
2021-10-15 10:53:32 +10:00
Michael Olbrich d2ce51d504 stream: decrement busy counter when releasing dequeued buffers
For buffers on the 'dequeued' list, the busy counter was already
incremented in impl_node_process_input(). So it must be decremented again
when these buffers are removed.
2021-10-14 19:16:56 +00:00