Commit graph

1248 commits

Author SHA1 Message Date
Wim Taymans
312864d9e9 protocol-native: attempt to remove socket
After we grab the lockfile we should remove the socket when it
exists so that we can bind again. This should solve startup
problems after a crash, which left the socket around and caused
bind failures.
2019-09-26 15:41:03 +02:00
Wim Taymans
9a202272f2 remote: always close the fd in connect_fd
Not closing the fd causes leaks in existing apps. It's probably better
to always close it and let apps deal with that by using dup or similar.

Make gst sink and source dup the fd before connect_fd().

Fixes #181
2019-09-10 11:08:38 +02:00
Wim Taymans
633c27824f add sentinel to parser as well 2019-07-09 21:16:56 +02:00
Wim Taymans
9b4b915f25 add SPA_SENTINEL 2019-07-09 21:13:26 +02:00
Michael Tretter
39c01ba2fe builder: fix calls to builder_add that are not terminated by NULL
spa_pod_builder_add() is a va_args function that is terminated by a NULL
argument. The last argument must be a pointer type, because otherwise
checking for a NULL pointer can fail.

The __attribute__((__sentinel__)) prints a compiler warning, if the last
argument of a call to spa_pod_builder_add() is not a pointer type.

Fix all sentinel warnings by replacing all integer type 0 with pointer
type NULL in calls to spa_pod_builder_add().
2019-07-09 20:53:44 +02:00
Wim Taymans
4350bd624f Revert "global: combine all permissions of the object tree"
This reverts commit 83bc033837.

This needs some more work.
2019-06-28 12:23:56 +02:00
Wim Taymans
0720e375a1 avoid error(), it's not defined on musl 2019-06-21 16:33:49 +02:00
Michael Olbrich
37e66c9e55 deviceprovider: fix probing without starting
self->type is needed in registry_event_global() so it must be set in
gst_pipewire_device_provider_probe() as well.

self->devices is initialized as NULL when probing is started. So it should
be just a simple GList* pointer.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-06-19 11:00:48 +02:00
Wim Taymans
0a6fe99a63 protocol: improve error handling 2019-06-19 10:59:00 +02:00
Wim Taymans
151b2b266e connection: add do_close flag to connect_fd
Make pw_remote_connect_fd() not automatically close the provided
fd but let the caller take care of that. This allows us to reuse
the fd in pipewiresrc.

Fixes #155
2019-06-19 10:54:34 +02:00
Wim Taymans
37613b67ba alsa: handle alsa-lib 1.1.9
alsa-lib 1.1.9 removed /usr/include/alsa from the include path, we
must include <alsa/asoundlib.h>
2019-05-23 09:25:51 +02:00
Wim Taymans
4aff470a8f Release 0.2.6 2019-05-22 11:44:12 +02:00
Michael Olbrich
85e2eba941 gstpipewiresrc: clear timestamps when processing a buffer
This is necessary for 'do-timestamp' to work if the source provides no
timestamps. Without this, the timestamp from the first use will remain,
because the basesrc only overwrites timestamps that are
GST_CLOCK_TIME_NONE.
2019-05-22 10:51:04 +02:00
Thomas Zimmermann
cc5a155c9b meson.build: Test for ptrdiff_t in <stddef.h>
The build scripts assumed ptrdiff_t to just be around by default. But POSIX
specifies ptrdiff_t to be defined in <stddef.h>, which is now included from
the test.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Thomas Zimmermann
59fa57f2a3 autogen.sh: Immediately fail on command errors
If a command fails, there's no point in continuing with configuring
the project. Exit immediately.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Thomas Zimmermann
768b082834 autogen.sh: Check for meson
If meson is not installed, at least an error message should be printed.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Thomas Zimmermann
62afada593 autogen.sh: Put meson arguments right after command name
According to the meson man page, arguments go directly after the command's
name. Rearrange the call accordingly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Thomas Zimmermann
352b04ba21 autogen.sh: Replace symbolic link to Makefile
The autogen.sh script creates a symbolic link to the build/Makfile. If
the link already exists, a warning is printed and the old link persists.
Now replace it with the correct target.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Thomas Zimmermann
473fb330cf autogen.sh: Reuse existing build directory
Removing the build directory might delete important development files
as well.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-05-22 10:19:58 +02:00
Wim Taymans
0951a97a36 destroy resources first, then the global 2019-05-22 10:09:48 +02:00
Wim Taymans
c67f903c61 Return -EEXIST when registering an object twice 2019-05-22 10:09:12 +02:00
Wim Taymans
92808809ec client-node: don't destroy the resource from its event
Do no destroy the resource from within the event handler
2019-05-22 10:05:24 +02:00
Wim Taymans
b700d76ff4 list: use spa_list_consume some more
If we know the item is removed in each iteration, _consume can handle
deletion of any item while being iterated.
2019-05-21 17:11:27 +02:00
Michael Olbrich
6b269cce35 node: use spa_list_for_each_safe() for pw_node_events_*
Introduce spa_hook_list_call_simple_safe() as a new helper that uses
spa_list_for_each_safe() and use it for pw_node_events_* This way multiple
threads can iterate at the same time and, if only one thread is active, the
current list entry can be safely removed (e.g. in
pw_node_events_destroy()).

Without this the node listener_list may be corrupted when the main and data
loop iterate over the list at the same time (See #143).
2019-05-21 17:10:09 +02:00
Jonas Ådahl
323917ab4b module-portal: Handle no app_id being set
Avoid crashing if the portal would for whatever reason fail to set this.
2019-05-20 16:10:12 +02:00
Jonas Ådahl
55eadd6c4c module-portal: Ignore if pipewire.access.portal.is_portal is "yes"
This is for the remotes that the portal itself owns, such as ones that
track the number of cameras.
2019-05-20 16:10:12 +02:00
Wim Taymans
abaf40ba8b core: small cleanup in _find_format() 2019-05-17 12:37:25 +02:00
Michael Olbrich
1c8daa4a50 core: fix pw_core_find_format() for active ports
pw_core_find_format() is currently broken when one of the ports is already
active: The format of the active port is used and the other port is
completely ignored.
As a result, the autolink module may try to link a new port to the first
already active port even if the formats do not match.

To fix this, use the format of the active port as a filter and enumerate
the formats of the other port.
2019-05-17 12:23:49 +02:00
Jonas Ådahl
777b97b7d8 module-portal: Use permission store for portal initiated clients
Detect what clients were started by the portal, and use the permission
store to determine permissions of existing and future nodes.

Clients are detected whether they are from the portal or not by
comparing the PID of the client with the PID of the owner of the
portal D-Bus name.

It is assumed that the portal will set an appropriate app_id, and a
comma seperated list of media roles (e.g. "Camera"), that should be
queried. If app_id is an empty string, it's assumed to be a
non-sandboxed client, and permissions are assumed to be allowing.
2019-05-16 18:07:52 +02:00
Jonas Ådahl
31145b58dc Rename module-flatpak module-portal
It'll use the portal and permission store explicitly, and nothing
particularly flatpak specific.
2019-05-16 18:07:52 +02:00
Jonas Ådahl
3ce0c4b81a pipewire/node: Pass along 'media.role' node property too 2019-05-16 18:07:52 +02:00
Michael Olbrich
5f507c804f remove libv4l2 dependency
It's not used anywhere right now.
2019-05-14 13:21:53 +02:00
Wim Taymans
98da5a2e9e global: emit permissions_changed event
Add a permissions_changed event when the permissions change for a
global for a client.
Recheck if a link is still allowed when node permissions changed
and destroy the link if not.
2019-05-13 17:04:43 +02:00
Wim Taymans
83bc033837 global: combine all permissions of the object tree
To get the permissions of an object, combine the permissions
of the object and all the parent nodes up to the root.

This is necessary to enforce that a client can never see and
object id (in this case the parent id) it is not allowed to see.
2019-05-13 15:46:32 +02:00
Wim Taymans
d7acbb222e link: check permissions
When creating a link between two nodes, check if the owner of a
node (when it is a client) can see the other node.
2019-05-13 12:51:20 +02:00
Wim Taymans
3854f8557a protocol: add security label to a client
Don't pass the ucred to the client construct, just set the properties
in the protocol.
Use the client properties to get ucred.
Add the security label to the client properties (from SO_PEERSEC)
2019-05-10 13:12:22 +02:00
Wim Taymans
e0eeedc369 core: don't send remove_id in hello
The hello method should also destroy the resources for a client but not
send a remove_id for them.
2019-05-10 12:09:26 +02:00
Wim Taymans
5d2f0f5182 remote: only remove the proxy id when it existed 2019-05-06 17:48:23 +02:00
Wim Taymans
7670ee7eec core: destroy all resources on hello
Destroy all resources (except the core) for a client when it
does a hello. This typically needs to be done after passing the
connection fd from one client to another.
2019-05-06 17:05:05 +02:00
Wim Taymans
2b5c6fd676 list: add _consume method
Add safer way to destroy a list of objects.
2019-05-06 17:04:16 +02:00
Wim Taymans
fa0b4f9321 client: properties with "pipewire." prefix are read-only
Properties that start with "pipewire." can only be set once. This
prevents a client from overwriting the ucred or any of the other
protected properties once they are set by the core or a module.
2019-05-06 15:41:26 +02:00
Wim Taymans
3f5b3b7cb1 pipewiresrc: actually use the fd when set 2019-05-06 12:07:25 +02:00
Wim Taymans
e4be9837c4 v4l2: add Camera media.role 2019-04-30 15:54:29 +02:00
Wim Taymans
9f7c9022cf format: map all mjpeg formats to video/mjpeg
Fixes #139
2019-04-10 17:03:14 +02:00
Wim Taymans
9f2cfe1cd6 rtkit: improve DISABLE_RTKIT
DISABLE_RTKIT should not even try to get the dbus connection or
anything.
2019-04-10 16:45:44 +02:00
Nicolas Dufresne
6e7db20bf5 rtkit: Allow disabling with DISABLE_RTKIT
Allow disabling real time thread, this is useful to run inside
valgrind without being killed.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2019-04-10 16:45:38 +02:00
Matthias Fend
bdc81f6dc0 daemon: use correct type for getopt_long() return value
Depending on the compiler configuration 'char' may be an unsigned type
which will not work as expected.

Signed-off-by: Matthias Fend <matthias.fend@wolfvision.net>
2019-04-02 23:26:40 +02:00
Philipp Zabel
181a6a2cea v4l2: do not keep non-capture devices open
If VIDIOC_QUERYCAP fails, or V4L2_CAP_VIDEO_CAPTURE is not set,
spa_v4l2_open should close the port file descriptor again.
2019-04-02 23:25:34 +02:00
ncraun-vivint
737851df6c Quote "$@" in autogen.sh
An unquoted $@ will break for arguments with spaces in their names. Unquoted $@ will work until it doesn't, and then it can be tricky to track down exactly what went wrong. Using "$@" will save someone some headache in the future.
2019-02-13 11:18:31 +01:00
Wim Taymans
f6391be214 add SPA_EXPORT where needed 2019-02-06 11:59:05 +01:00