Commit graph

141 commits

Author SHA1 Message Date
Barnabás Pőcze
e6e36c4d34 tests: endpoint: fix valgrind uninit warning
Previously, valgrind was warning that

  Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)

this was caused by uninitialized values being serialized for IPC.
Specifically, not all members of the `pw_endpoint_info` struct were
initialized, which caused uninitialized bytes to end up in the IPC
buffers due to the `pw_endpoint_emit_info()` in `endpoint_add_listener()`.

Fix that by initializing the missed `id` and `flags` members.
2025-07-20 18:36:20 +02:00
Barnabás Pőcze
17fcc9fc51 pw-container: use smaller path for temporary file
The automatically deduced size is sufficient. This
prevents a -Wformat-overflow warning.
2024-06-27 21:18:06 +00:00
Wim Taymans
1ae4374ccf Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
2024-06-18 12:17:56 +02:00
Wim Taymans
6499b8572e tests: don't crash when security context is not available
Fixes #3952
2024-04-15 16:41:03 +02:00
Wim Taymans
9c072832f0 tests: cleanup correctly to avoid leaks 2024-03-15 13:08:58 +01:00
Wim Taymans
df50952f48 tests: add right include for close/unlink/pipe2 2024-03-15 12:39:20 +01:00
Wim Taymans
76ce2f77a4 test: handle running without a server
The security context test requires a running server, exit gracefully for
now when there is server running, like in the CI.
2024-03-15 12:25:30 +01:00
Wim Taymans
6c6046f5ac tests: update unit test for added field 2024-03-15 12:10:40 +01:00
Wim Taymans
81181e255f tools: add pw-container tool
This makes a new custom security context with the given properties
and runs the program in this context.
2024-03-13 12:53:04 +01:00
Wim Taymans
477c6e8e90 protocol-native: improve security context properties
Remove the engine_name, use pipewire.sec.engine in the properties. Make
some constants for this.

Document some more properties.
2024-03-13 12:53:04 +01:00
Wim Taymans
e7846fc12a protocol-native: add security context API
Add a new extension that can create a server on a user provided socket
with user provided security properties.

This is mainly used in flatpaks that want to create and bind a pipewire
socket with specific permissions for the flatpak app.

The flatpak will also provide an fd that will be closed when the server
can be removed.
2024-03-13 12:53:04 +01:00
Wim Taymans
a1ecfc8d7f tests: fix ABI check for new pw_time 2024-01-15 15:53:19 +01:00
Wim Taymans
fb8709716c core: add bound_props event
this event extends the bound_id event and sends the global properties as
well.

This can be used to get the object.serial, for example.

It can also be used in the future to let the server generate unique
property values, like the node.name, and let the client know about the
new property value.
2023-03-21 17:22:27 +01:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
41dd96426c tests: fix clang build 2022-07-08 16:56:48 +02:00
Wim Taymans
3a8275427e tests: wait for the filter node as well
Use the filter state to see when the filter was connected. It needs 2
roundtrips to get the filter to show in the registry.
2022-07-08 16:09:26 +02:00
Wim Taymans
8109f9a42d tests: make a test for ports
Test if adding a port will result in a new Port global.
2022-07-08 15:56:42 +02:00
Wim Taymans
e92e90bd3f tests: add filter unit test 2022-07-08 15:16:41 +02:00
Quentin Wenger
22fc9eec35 Cleanup argument names in methods and events interfaces
First method argument is object, first event argument is data.

Closes !963
2022-04-15 10:11:49 +02:00
Wim Taymans
4a5129bdb4 fix stream test 2022-03-31 10:38:51 +02:00
Wim Taymans
2f5bba112f spa: Improve PropInfo fields
The PropInfo either has a registered id (and then also a name from the
type-info) or a custom name as a string.
In all cases, the description contains a free form text that clarifies
the property.

Use the description in the stream controls name.
2022-03-30 17:09:08 +02:00
Wim Taymans
5a9d2679ca stream: add pw_stream_get_time_n()
Deprecate pw_stream_get_time() in favour of _get_time_n() that contains
the size of the pw_time structure. Make the old one fill in the fields
up to the buffered field. Make the new one use the size to decide how
much info to fill in.

Add a new buffered field in pw_time that contains the buffered data
inside the converter/resampler. This leaves the queued field with
purely the user provided size in the buffers.

Use get_time_n() in places.
2022-03-29 17:30:38 +02:00
Wim Taymans
5192fcb16c stream: add the requested number of samples in buffer
Add a new pw_buffer field with the requested number of samples to
fill the resampler.
2022-03-29 09:57:48 +02:00
Barnabás Pőcze
ec465966bc treewide: meson.build: simplify get_variable() calls
Since 01c6fd0a88 the
minimum required meson version is 0.59.0, and since
meson 0.58.0, `get_variable()` on a dependency object
accepts a positional argument. The "type" of variable
(internal, pkgconfig, etc.) in that case does not need
to be specified explicitly.
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
93b4fc59cf treewide: meson.build: get PIPEWIRE_{CONFIG,MODULE}_DIR from dependency
Instead of hard-coding the paths relative to the project root,
retrieve the correct paths from `pipewire_dep`.
2021-12-28 18:40:41 +01:00
Barnabás Pőcze
26eb66fb5b treewide: meson.build: get SPA_PLUGIN_DIR from dependency
Instead of hard-coding the path relative to the project root,
retrieve the correct path from `spa_dep`.
2021-12-28 18:39:17 +01:00
Barnabás Pőcze
8ed46a283f treewide: meson.build: use project_{build,source}_root()
Use `meson.project_{build,source}_root()` instead of
`meson.{build,source}_root()` because those functions
do not work as expected when used inside a subproject,
and they have been deprecated in meson 0.56.0.
2021-12-28 18:37:18 +01:00
Wim Taymans
2112a7287b tests: add new ABI test for stream 2021-10-27 11:31:39 +02:00
Gleb Popov
e26b40a75f Fix compiler warning by spelling the initializer properly. 2021-10-22 19:04:47 +03:00
Wim Taymans
002566ae83 test: fix stream ABI test 2021-10-19 17:16:25 +02:00
Peter Hutterer
abd5f9fbe8 Remove remaining tabs from meson.build files
No changes, just tab-to-space replacement and a little bit of manual
twiddling.
2021-09-30 00:08:27 +00:00
Nils Tonnätt
dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt
f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Peter Hutterer
d0060fbddd test: move the client and utils tests over here 2021-08-04 07:45:06 +00:00
Peter Hutterer
49f3d5842e test: replace all spa_assert() macros with spa_assert_se()
These are tests, we never want those to be optimized away.
2021-07-27 10:24:44 +10:00
Peter Hutterer
1bd43e8282 test: skip the endpoint test under valgrind
This test currently prevents us from running the test suite in valgrind but
it's not a straightforward fix. So in the meantime, skip this test when
running under valgrind.
2021-07-07 11:03:23 +00:00
Peter Hutterer
0f5e462909 tests: fix indentation issues in meson.build 2021-07-07 11:03:23 +00:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Peter Hutterer
62e98aa836 test: move some of the property tests to pwtest
Mostly 1:1 move of the test-properties.c file in src to the one in test, but a
few checks were merged into the existing functions.
2021-06-17 07:08:53 +00:00
Wim Taymans
77a4ae380e json: remove obsolete # comment handling
Comments are handled by the parser now. Keys and values starting
with # are intentional now.
2021-06-10 18:02:34 +02:00
Peter Hutterer
dcfd6745d0 test: move the context tests to here 2021-06-09 18:00:39 +10:00
Peter Hutterer
493f0724b5 test: move the array tests to pwtest
Add them to the existing pw_properties test binary and rename that to
pw-utils.

Same functionality as before for the pw_array tests.
2021-06-09 18:00:39 +10:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Barnabás Pőcze
6affda9424 pipewire: utils: add more tests for pw_split_walk() 2021-06-03 17:23:42 +02:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10: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
a243d126db Fix tests, use the right config dir 2021-02-12 10:33:02 +01:00
Wim Taymans
fc90a4e48a Implement config/state file handling
Make methods to load_config and load/save state. For now the config
and state directories are the same but it might not be. Implement
the search path for all config/state files as:

  $XDG_CONFIG_HOME/[$prefix]/$name
  $HOME/.config/[$prefix]/$name
  $PIPEWIRE_CONFIG_DIR/pipewire/[$prefix]/$name
  /etc/pipewire/[$prefix]/$name

Make some config files for jack and RT clients. Make pw-cat use the
client-rt config.

Use core state and config management in media-session.
Move all session manager state and config files to the build dir and
set the PIPEWIRE_CONFIG_DIR to this build dir.
2021-02-12 10:25:11 +01:00