gst: share the core between connections

Make all sources in the same process with the same fd share the
connection to the server. This makes it possible to set the same
fd on multiple sources/sinks and have them all use the same
connection, like when capturing multiple monitors from screencast
with the portal.

Fixes #241
This commit is contained in:
Wim Taymans 2020-07-13 17:42:09 +02:00
parent ba96eecba0
commit 70652d1a37
7 changed files with 328 additions and 188 deletions

View file

@ -30,6 +30,7 @@
#include <pipewire/pipewire.h>
#include <gst/gstpipewirepool.h>
#include <gst/gstpipewirecore.h>
G_BEGIN_DECLS
@ -83,14 +84,8 @@ struct _GstPipeWireSink {
/* video state */
gboolean negotiated;
struct pw_thread_loop *loop;
struct pw_context *context;
struct pw_core *core;
GstPipeWireCore *core;
struct spa_hook core_listener;
int pending_seq;
int last_seq;
int last_error;
struct pw_stream *stream;
struct spa_hook stream_listener;