Commit graph

268 commits

Author SHA1 Message Date
George Kiagiadakis
b29b313e7b tests: wplua: add a test for asynchronous script activation 2022-04-23 20:14:59 +03:00
George Kiagiadakis
ecb6100b77 m-lua-scripting: wrap every script in a WpPlugin and expose async activation api
This allows scripts to declare when they have finished their loading,
so we can now also know when wireplumber is done loading and ready to
handle clients

Related to !313
2022-04-23 20:14:59 +03:00
George Kiagiadakis
9387ce0d95 wplua: implement reference counting of the lua_State 2022-04-23 20:14:59 +03:00
George Kiagiadakis
9c22f6076a wplua: enable the use of require() to load lua libraries from scripts/lib 2022-04-23 20:14:59 +03:00
George Kiagiadakis
e1d0240bc9 wplua: split the functionality of the load functions into smaller functions
The load functions used to do 3 things:
- push the sandbox function on the stack
- load the file and push it as a function on the stack
- call the sandbox (or the file)

Now there are separate functions to do these 3:
- wplua_push_sandbox
- wplua_load_*
- wplua_pcall
2022-04-23 20:14:59 +03:00
Ashok Sidipotu
f032ac00cf properties: Add get count API
This API returns the count of the number of properties or items.
2022-03-24 06:59:39 +00:00
Wim Taymans
f46a801edb tests: use GNU_SOURCE for compiling tests as well
So that strtod_l is found.
2022-03-21 12:01:00 +01:00
George Kiagiadakis
44a09a1050 tests: spa-json: add a test to verify that we can parse the spa-json format
The spa-json parser allows some interesting things to happen, which
are not valid JSON, but we use them for readability in config files...

- The separator may be = or just a space instead of :
- Strings may be unquoted
- Commas may be omitted
2022-03-16 21:25:07 +02:00
Julian Bouzas
585ad72c7c spa-json: add null character when finishing building json 2022-02-01 16:07:12 +00:00
Julian Bouzas
b0ddd6f890 m-lua-scripting: add Json.Raw constructor 2022-01-26 09:53:24 -05:00
Julian Bouzas
20187e07b5 m-lua-scripting: add WpSpaJson API 2022-01-25 07:20:35 -05:00
Julian Bouzas
4c1574117a spa-json: add new WpSpaJson API 2022-01-25 07:20:35 -05:00
Wim Taymans
7d4369c1af tests: don't leak fd in test 2022-01-21 09:45:29 +01:00
Julian Bouzas
72b3be9e83 m-si-audio-endpoint: use an internal audio adapter session item
Avoids code duplication with si-audio-adapter.
2021-10-21 14:03:10 -04:00
Julian Bouzas
6624eaaf3e m-si-audio-adapter: remove unused audio utilities 2021-10-20 07:41:21 +00:00
Ashok Sidipotu
e2e3c5a69c wp-factory: enumerate pw_factory objects
pw_factory objects allow permissions to be set on its clients,
wp-factory exposes this funtionality to wireplumber clients.
2021-10-19 05:46:46 +00:00
George Kiagiadakis
c444ebaae1 meson: replace deprecated dep.get_pkgconfig_variable() with dep.get_variable() 2021-10-15 12:12:20 +03:00
George Kiagiadakis
03f14105cf si-audio-adapter: find the device format early and store format-specific flags
* find out if the node supports iec958 or dsd
* use spa_pod_fixate() to get the default format of the node, like p-m-s does
* use _enum_formats_sync() to utilize the param cache, assuming that the node
  always has all features enabled (which is always the case when coming from
  an ObjectManager that was defined in Lua)
* simplify the activation / deactivation procedure
* configure nodes with unpositioned channels early, as if they were devices
2021-10-12 20:00:10 +03:00
George Kiagiadakis
e76c67c45c policy: refactor/improve policy-node & session items to fix linking to monitors
* populate most session item properties from create-item.lua to keep
  things more compact and readable
* use a standard naming scheme for the session item properties
* use session item properties instead of node properties in policy-node.lua
* improve policy-node's performance by converting the properties dictionary
  less times for each session item
* refactor some policy logic and make things slighly more readable
* change the accepted values for 'context' in wp_si_linkable_get_ports();
  use "input" and "output" to keep things clear, because the previous use
  of NULL and "reverse" were implying that a node has only one "standard"
  direction, but this is complicated for sinks w/ monitors and duplex nodes
* allow using monitors (which are Audio/Sink nodes in fact) as sources
* treat Audio/Duplex nodes as sinks, like p-m-s does
* respect the "stream.capture.sink" property of streams

Fixes #66
2021-10-08 00:26:41 +03:00
Julian Bouzas
711d1ee686 spa-pod: add support for custom Id properties
Allows creating and parsing Pod Objects with custom properties.
2021-09-21 12:29:54 -04:00
George Kiagiadakis
8949e98d1f remove wpipc
This component has been split out to form a separate project,
moved to https://git.automotivelinux.org/src/pipewire-ic-ipc/
2021-08-19 16:53:28 +03:00
George Kiagiadakis
e6f2dc17ff tests: file-monitor: also remove the 'foo' file at the end of the test 2021-08-19 10:44:31 +03:00
George Kiagiadakis
daa4da5ffc tests: state: remove the "escaped" state file at the end of the test 2021-08-19 10:39:49 +03:00
George Kiagiadakis
07b4a13315 tests: use .local/state instead of .local/.state for the state dir 2021-08-19 10:39:14 +03:00
Julian Bouzas
907a67fcb1 modules: add new API module to monitor files 2021-08-10 11:50:51 +03:00
Julian Bouzas
8b95b4ae23 tests: skip test if specific spa lib is not installed
Avoids tests failing if pipewire was built without the spa lib
2021-07-19 09:40:19 -04:00
Julian Bouzas
eb8f9a1a83 tests: common: add API to check if spa lib is installed
Allows to skip tests if specific spa lib is not installed
2021-07-16 11:49:35 -04:00
Julian Bouzas
2792cecbcf properties: use a boxed WpPropertiesItem type when iterating
Needed for JavaScript bindings
2021-07-15 08:55:00 -04:00
Peter Hutterer
be1a077eaf state: store our WpState files in $XDG_STATE_HOME/wireplumber 2021-07-14 14:44:11 +10:00
George Kiagiadakis
6e6852b391 tests: create wpipc tests sockets also in /tmp with a random name
See #39, #16
2021-07-02 16:34:31 +03:00
George Kiagiadakis
655898e61f tests: run with PIPEWIRE_RUNTIME_DIR=/tmp
... and hope for the best, because sockets apparently can't
have more than 108 characters in their path

See #39, #16
2021-07-02 16:34:28 +03:00
Julian Bouzas
ee190411f4 state: escape invalid key file characters 2021-06-30 08:48:57 -04:00
Julian Bouzas
8505078a80 tests: endpoint: fix coverity 'side effect in assertion' error 2021-06-30 08:44:35 -04:00
George Kiagiadakis
d576fde2d7 tests: set PIPEWIRE_RUNTIME_DIR and stop using XDG_RUNTIME_DIR
Using XDG_RUNTIME_DIR is problematic in test-reserve-device
because GTestDBus also exports XDG_RUNTIME_DIR and then unsets it,
which makes pipewire end up using $HOME for its socket.
Using PIPEWIRE_RUNTIME_DIR is safer, as this variable is only used
by pipewire.

Also use the build directory as a runtime dir (it always exists and
nothing is going to interfere with it) and unset XDG_RUNTIME_DIR from
the CI scripts, since nothing else is using it.

Closes #39
2021-06-30 11:53:21 +03:00
Julian Bouzas
85820f7aef tests: examples: print error if buffer is not valid in wpipc-client
If we lose connection with the server while a request was pending, the request
callback is still triggered but with NULL buffer.
2021-06-28 11:38:38 -04:00
Julian Bouzas
9fd76570c4 tests: wpipc: check if new connection to new receiver is valid after losing connection 2021-06-28 11:38:37 -04:00
Julian Bouzas
ac4d5bd22a tests: wpipc: use GCond instead of while loop to wait for events
Fixes hanging issues when running test with valgrind.
2021-06-28 11:38:37 -04:00
Julian Bouzas
d0b26fd70f tests: wpipc: fix typo in sender-receiver unit test 2021-06-28 11:38:37 -04:00
Julian Bouzas
f7483ebd3d tests: transition: make sure transition is still valid after advancing
Advancing a transition might free it, so we ref before advancing it, and unref
after checking its completion.
2021-06-25 11:04:15 -04:00
Julian Bouzas
70197f498c tests: fix coverity scan side effect in assertion issues 2021-06-25 08:50:08 -04:00
Julian Bouzas
892b0dada6 lib: Use #define instead of 'static const' for constants
Fixes build errors when using GCC older than v8.1
2021-06-24 09:24:16 -04:00
George Kiagiadakis
c24db9f353 tests: add pipewire env variables when running tests, tidy up common_env
Related to pipewire!767
2021-06-18 19:34:25 +03:00
George Kiagiadakis
b222411356 tests/metadata: also fix failing metadata unit test
latest pipewire exports settings metadata too, so we need to filter
2021-06-18 15:30:55 +03:00
George Kiagiadakis
b6a5750595 Revert "tests: enable G_SLICE=debug-blocks in all tests"
This breaks the valgrind test setup, as this G_SLICE overrides
G_SLICE=always-malloc from valgrind_env

This reverts commit a0d0069f18.
2021-06-10 14:52:30 +03:00
George Kiagiadakis
606a9765d6 meson: add '--keep-debuginfo=yes' to the valgrind command line
ensures that we get debug symbols from modules printed correctly
2021-06-09 15:43:08 +03:00
George Kiagiadakis
7355215cf1 pipewire-object: change params-changed signal to take a string param name
To be consistent with the rest of the API where strings are used
to identify param types
2021-06-09 13:29:34 +03:00
George Kiagiadakis
a0d0069f18 tests: enable G_SLICE=debug-blocks in all tests
This can catch allocation mistakes in the g_slice allocator
2021-06-09 12:21:56 +03:00
George Kiagiadakis
82c054f1bd meson: use environment() objects to define env for tests
it's just a nicer syntax
2021-06-09 12:03:14 +03:00
George Kiagiadakis
b39514a455 meson: add a test setup to run tests under valgrind 2021-06-09 11:55:07 +03:00
Julian Bouzas
0f01c8b6da tests: si-standard-link: remove unneeded core syncs 2021-06-08 13:23:44 -04:00