summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricia Muscalu <patricia@axis.com>2016-01-13 10:55:40 +0100
committerSebastian Dröge <sebastian@centricular.com>2016-02-23 17:05:15 +0200
commit66389cb900d5c4c974b619ad3b5d8d23bea2b863 (patch)
tree508cdc5b6e9bd51dd1556f00424d04af762d9983
parentc0cadc6ec3a4b81506d6cc19f72cc9be1f91f064 (diff)
rtsp-stream: added function for setting UDP sources to PLAYING state
Code refactoring: Introduced a function for setting UDP sources to PLAYING state. https://bugzilla.gnome.org/show_bug.cgi?id=757488
-rw-r--r--gst/rtsp-server/rtsp-stream.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c
index f305ea5..15fca19 100644
--- a/gst/rtsp-server/rtsp-stream.c
+++ b/gst/rtsp-server/rtsp-stream.c
@@ -1105,6 +1105,58 @@ no_udp_protocol:
}
/* must be called with lock */
+static void
+play_udpsources_one_family (GstRTSPStream * stream, GSocketFamily family)
+{
+ GstRTSPStreamPrivate *priv;
+ GstPad *pad, *selpad;
+ guint i;
+ GstBin *bin;
+
+ priv = stream->priv;
+ bin = GST_BIN (gst_object_get_parent (GST_OBJECT (priv->funnel[1])));
+
+ for (i = 0; i < 2; i++) {
+ if (priv->sinkpad || i == 1) {
+ if (family == G_SOCKET_FAMILY_IPV4 && priv->udpsrc_v4[i]) {
+ if (priv->srcpad) {
+ /* we set and keep these to playing so that they don't cause NO_PREROLL return
+ * values. This is only relevant for PLAY pipelines */
+ gst_element_set_state (priv->udpsrc_v4[i], GST_STATE_PLAYING);
+ gst_element_set_locked_state (priv->udpsrc_v4[i], TRUE);
+ }
+ /* add udpsrc */
+ gst_bin_add (bin, priv->udpsrc_v4[i]);
+
+ /* and link to the funnel v4 */
+ selpad = gst_element_get_request_pad (priv->funnel[i], "sink_%u");
+ pad = gst_element_get_static_pad (priv->udpsrc_v4[i], "src");
+ gst_pad_link (pad, selpad);
+ gst_object_unref (pad);
+ gst_object_unref (selpad);
+ }
+
+ if (family == G_SOCKET_FAMILY_IPV6 && priv->udpsrc_v6[i]) {
+ if (priv->srcpad) {
+ gst_element_set_state (priv->udpsrc_v6[i], GST_STATE_PLAYING);
+ gst_element_set_locked_state (priv->udpsrc_v6[i], TRUE);
+ }
+ gst_bin_add (bin, priv->udpsrc_v6[i]);
+
+ /* and link to the funnel v6 */
+ selpad = gst_element_get_request_pad (priv->funnel[i], "sink_%u");
+ pad = gst_element_get_static_pad (priv->udpsrc_v6[i], "src");
+ gst_pad_link (pad, selpad);
+ gst_object_unref (pad);
+ gst_object_unref (selpad);
+ }
+ }
+ }
+
+ gst_object_unref (bin);
+}
+
+/* must be called with lock */
static gboolean
create_and_configure_udpsources_one_family (GstElement * udpsrc_out[2],
GSocket * rtp_socket, GSocket * rtcp_socket, GSocketFamily family)
@@ -2513,6 +2565,8 @@ gst_rtsp_stream_join_bin (GstRTSPStream * stream, GstBin * bin,
create_sender_part (stream, bin, state);
create_receiver_part (stream, bin, state);
+ play_udpsources_one_family (stream, G_SOCKET_FAMILY_IPV4);
+ play_udpsources_one_family (stream, G_SOCKET_FAMILY_IPV6);
if (priv->srcpad) {
/* be notified of caps changes */