Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
George Kiagiadakis
gst-plugins-good
Commits
2e5df10e
Commit
2e5df10e
authored
May 27, 2015
by
Tim-Philipp Müller
Browse files
dynudpsink: keep GCancellable fd around instead of re-creating it constantly
And create it only when starting the element.
parent
b33d3062
Changes
2
Hide whitespace changes
Inline
Side-by-side
gst/udp/gstdynudpsink.c
View file @
2e5df10e
...
...
@@ -162,7 +162,6 @@ gst_dynudpsink_init (GstDynUDPSink * sink)
sink
->
used_socket
=
NULL
;
sink
->
used_socket_v6
=
NULL
;
sink
->
cancellable
=
g_cancellable_new
();
}
static
void
...
...
@@ -172,10 +171,6 @@ gst_dynudpsink_finalize (GObject * object)
sink
=
GST_DYNUDPSINK
(
object
);
if
(
sink
->
cancellable
)
g_object_unref
(
sink
->
cancellable
);
sink
->
cancellable
=
NULL
;
if
(
sink
->
socket
)
g_object_unref
(
sink
->
socket
);
sink
->
socket
=
NULL
;
...
...
@@ -372,6 +367,26 @@ gst_dynudpsink_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static
void
gst_dynudpsink_create_cancellable
(
GstDynUDPSink
*
sink
)
{
GPollFD
pollfd
;
sink
->
cancellable
=
g_cancellable_new
();
sink
->
made_cancel_fd
=
g_cancellable_make_pollfd
(
sink
->
cancellable
,
&
pollfd
);
}
static
void
gst_dynudpsink_free_cancellable
(
GstDynUDPSink
*
sink
)
{
if
(
sink
->
made_cancel_fd
)
{
g_cancellable_release_fd
(
sink
->
cancellable
);
sink
->
made_cancel_fd
=
FALSE
;
}
g_object_unref
(
sink
->
cancellable
);
sink
->
cancellable
=
NULL
;
}
/* create a socket for sending to remote machine */
static
gboolean
gst_dynudpsink_start
(
GstBaseSink
*
bsink
)
...
...
@@ -381,6 +396,8 @@ gst_dynudpsink_start (GstBaseSink * bsink)
udpsink
=
GST_DYNUDPSINK
(
bsink
);
gst_dynudpsink_create_cancellable
(
udpsink
);
udpsink
->
external_socket
=
FALSE
;
if
(
udpsink
->
socket
)
{
...
...
@@ -552,6 +569,8 @@ gst_dynudpsink_stop (GstBaseSink * bsink)
udpsink
->
used_socket_v6
=
NULL
;
}
gst_dynudpsink_free_cancellable
(
udpsink
);
return
TRUE
;
}
...
...
@@ -574,8 +593,8 @@ gst_dynudpsink_unlock_stop (GstBaseSink * bsink)
udpsink
=
GST_DYNUDPSINK
(
bsink
);
g
_object_unref
(
udpsink
->
cancellable
);
udpsink
->
cancellable
=
g
_cancellable
_new
(
);
g
st_dyn
udpsink
_free_
cancellable
(
udpsink
);
gst_dynudpsink_create
_cancellable
(
udpsink
);
return
TRUE
;
}
gst/udp/gstdynudpsink.h
View file @
2e5df10e
...
...
@@ -52,6 +52,7 @@ struct _GstDynUDPSink {
/* the socket in use */
GSocket
*
used_socket
,
*
used_socket_v6
;
gboolean
external_socket
;
gboolean
made_cancel_fd
;
GCancellable
*
cancellable
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment