avoid fd-leaks

Set rank of source to PRIMARY + 1
This commit is contained in:
Wim Taymans 2015-05-18 16:58:16 +02:00
parent c2a35199f7
commit 98861cb940
3 changed files with 4 additions and 7 deletions

View file

@ -203,12 +203,7 @@ gst_fddepay_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
"buffer, received %i", fds_len);
goto error;
}
fd = dup (fds[0]);
if (fd < 0) {
GST_WARNING_OBJECT (fddepay, "fddepay: Could not dup FD %i: %s", fds[0],
strerror (errno));
goto error;
}
fd = fds[0];
fcntl (fd, F_SETFD, FD_CLOEXEC);
g_free (fds);
fds = NULL;
@ -228,6 +223,7 @@ gst_fddepay_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
GST_BUFFER_OFFSET (buf) = msg.seq;
return GST_FLOW_OK;
error:
if (fds)
g_free (fds);

View file

@ -44,7 +44,7 @@ plugin_init (GstPlugin * plugin)
GST_TYPE_FDPAY);
gst_element_register (plugin, "pvfddepay", GST_RANK_NONE,
GST_TYPE_FDDEPAY);
gst_element_register (plugin, "pulsevideosrc", GST_RANK_NONE,
gst_element_register (plugin, "pulsevideosrc", GST_RANK_PRIMARY + 1,
GST_TYPE_PULSEVIDEO_SRC);
gst_element_register (plugin, "pulsevideosink", GST_RANK_NONE,
GST_TYPE_PULSEVIDEO_SINK);

View file

@ -320,6 +320,7 @@ gst_pulsevideo_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
gst_memory_unmap (mem, &minfo);
}
g_unix_fd_message_append_fd ((GUnixFDMessage*)mesg, gst_fd_memory_get_fd (mem), NULL);
gst_memory_unref (mem);
info.message = mesg;
g_mutex_lock (&pvsink->lock);