diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 90b10a793..562d55c52 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "gstpipewireformat.h" @@ -738,7 +739,7 @@ gst_pipewire_sink_open (GstPipeWireSink * pwsink) if (pwsink->fd == -1) pw_remote_connect (pwsink->remote); else - pw_remote_connect_fd (pwsink->remote, pwsink->fd); + pw_remote_connect_fd (pwsink->remote, dup(pwsink->fd)); while (TRUE) { enum pw_remote_state state = pw_remote_get_state (pwsink->remote, &error); diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 442274889..1f372a810 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -984,7 +984,7 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc) if (pwsrc->fd == -1) pw_remote_connect (pwsrc->remote); else - pw_remote_connect_fd (pwsrc->remote, pwsrc->fd); + pw_remote_connect_fd (pwsrc->remote, dup(pwsrc->fd)); while (TRUE) { enum pw_remote_state state = pw_remote_get_state(pwsrc->remote, &error); diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 168c1420f..2b545f791 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -463,7 +463,7 @@ int pw_remote_connect_fd(struct pw_remote *remote, int fd) pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTING, NULL); - if ((res = pw_protocol_client_connect_fd(remote->conn, fd, false)) < 0) { + if ((res = pw_protocol_client_connect_fd(remote->conn, fd, true)) < 0) { pw_remote_update_state(remote, PW_REMOTE_STATE_ERROR, "connect_fd failed %s", spa_strerror(res)); return res; diff --git a/src/pipewire/remote.h b/src/pipewire/remote.h index 0cf837239..61192fb48 100644 --- a/src/pipewire/remote.h +++ b/src/pipewire/remote.h @@ -178,7 +178,7 @@ void pw_remote_add_listener(struct pw_remote *remote, int pw_remote_connect(struct pw_remote *remote); /** Connect to a remote PipeWire on the given socket \memberof pw_remote - * \param fd the connected socket to use, the socket will not be closed + * \param fd the connected socket to use, the socket will be closed * automatically on disconnect or error. * \return 0 on success, < 0 on error */ int pw_remote_connect_fd(struct pw_remote *remote, int fd);