summaryrefslogtreecommitdiff
path: root/src/gst
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-09-10 11:05:38 +0200
committerWim Taymans <wtaymans@redhat.com>2019-09-10 11:05:38 +0200
commitc9855763c3efb0a076affefe50c4561732c837fb (patch)
treede50a783022d9cff1c1efacd079c6edd2e736eae /src/gst
parentddd2a97f7e02a647ed9b3e94d3429a03ca656919 (diff)
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
Diffstat (limited to 'src/gst')
-rw-r--r--src/gst/gstpipewiresink.c3
-rw-r--r--src/gst/gstpipewiresrc.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c
index 90b10a79..562d55c5 100644
--- a/src/gst/gstpipewiresink.c
+++ b/src/gst/gstpipewiresink.c
@@ -41,6 +41,7 @@
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
+#include <unistd.h>
#include <sys/socket.h>
#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 44227488..1f372a81 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);