mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
rtsp-server: Expose the use_client_settings API
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=699935
This commit is contained in:
parent
3e119be829
commit
c5b3066c33
2 changed files with 78 additions and 0 deletions
|
@ -39,6 +39,7 @@ struct _GstRTSPServerPrivate
|
||||||
gchar *service;
|
gchar *service;
|
||||||
gint backlog;
|
gint backlog;
|
||||||
gint max_threads;
|
gint max_threads;
|
||||||
|
gboolean use_client_settings;
|
||||||
|
|
||||||
GSocket *socket;
|
GSocket *socket;
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ struct _GstRTSPServerPrivate
|
||||||
#define DEFAULT_SERVICE "8554"
|
#define DEFAULT_SERVICE "8554"
|
||||||
#define DEFAULT_BACKLOG 5
|
#define DEFAULT_BACKLOG 5
|
||||||
#define DEFAULT_MAX_THREADS 0
|
#define DEFAULT_MAX_THREADS 0
|
||||||
|
#define DEFAULT_USE_CLIENT_SETTINGS FALSE
|
||||||
|
|
||||||
/* Define to use the SO_LINGER option so that the server sockets can be resused
|
/* Define to use the SO_LINGER option so that the server sockets can be resused
|
||||||
* sooner. Disabled for now because it is not very well implemented by various
|
* sooner. Disabled for now because it is not very well implemented by various
|
||||||
|
@ -82,6 +84,7 @@ enum
|
||||||
PROP_SESSION_POOL,
|
PROP_SESSION_POOL,
|
||||||
PROP_MOUNT_POINTS,
|
PROP_MOUNT_POINTS,
|
||||||
PROP_MAX_THREADS,
|
PROP_MAX_THREADS,
|
||||||
|
PROP_USE_CLIENT_SETTINGS,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -206,6 +209,17 @@ gst_rtsp_server_class_init (GstRTSPServerClass * klass)
|
||||||
"The maximum amount of threads to use for client connections "
|
"The maximum amount of threads to use for client connections "
|
||||||
"(0 = only mainloop, -1 = unlimited)", -1, G_MAXINT,
|
"(0 = only mainloop, -1 = unlimited)", -1, G_MAXINT,
|
||||||
DEFAULT_MAX_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
DEFAULT_MAX_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
/**
|
||||||
|
* GstRTSPServer::use-client-settings:
|
||||||
|
*
|
||||||
|
* Use client transport settings (destination, port pair and ttl for
|
||||||
|
* multicast. FALSE means that the server settings will be used.
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class, PROP_USE_CLIENT_SETTINGS,
|
||||||
|
g_param_spec_boolean ("use-client-settings", "Use Client Settings",
|
||||||
|
"Use client settings for ttl, destination and port pair in multicast",
|
||||||
|
DEFAULT_USE_CLIENT_SETTINGS,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gst_rtsp_server_signals[SIGNAL_CLIENT_CONNECTED] =
|
gst_rtsp_server_signals[SIGNAL_CLIENT_CONNECTED] =
|
||||||
g_signal_new ("client-connected", G_TYPE_FROM_CLASS (gobject_class),
|
g_signal_new ("client-connected", G_TYPE_FROM_CLASS (gobject_class),
|
||||||
|
@ -236,6 +250,7 @@ gst_rtsp_server_init (GstRTSPServer * server)
|
||||||
priv->session_pool = gst_rtsp_session_pool_new ();
|
priv->session_pool = gst_rtsp_session_pool_new ();
|
||||||
priv->mount_points = gst_rtsp_mount_points_new ();
|
priv->mount_points = gst_rtsp_mount_points_new ();
|
||||||
priv->max_threads = DEFAULT_MAX_THREADS;
|
priv->max_threads = DEFAULT_MAX_THREADS;
|
||||||
|
priv->use_client_settings = DEFAULT_USE_CLIENT_SETTINGS;
|
||||||
g_queue_init (&priv->loops);
|
g_queue_init (&priv->loops);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,6 +702,55 @@ gst_rtsp_server_get_max_threads (GstRTSPServer * server)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_server_set_use_client_settings:
|
||||||
|
* @server: a #GstRTSPServer
|
||||||
|
* @use_client_settings: whether to use client settings for multicast
|
||||||
|
*
|
||||||
|
* Use client transport settings (destination, port pair and ttl) for
|
||||||
|
* multicast.
|
||||||
|
* When @use_client_settings is %FALSE, the server settings will be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_rtsp_server_set_use_client_settings (GstRTSPServer * server,
|
||||||
|
gboolean use_client_settings)
|
||||||
|
{
|
||||||
|
GstRTSPServerPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_RTSP_SERVER (server));
|
||||||
|
|
||||||
|
priv = server->priv;
|
||||||
|
|
||||||
|
GST_RTSP_SERVER_LOCK (server);
|
||||||
|
priv->use_client_settings = use_client_settings;
|
||||||
|
GST_RTSP_SERVER_UNLOCK (server);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_server_get_use_client_settings:
|
||||||
|
* @server: a #GstRTSPServer
|
||||||
|
*
|
||||||
|
* Check if client transport settings (destination, port pair and ttl) for
|
||||||
|
* multicast will be used.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_rtsp_server_get_use_client_settings (GstRTSPServer * server)
|
||||||
|
{
|
||||||
|
GstRTSPServerPrivate *priv;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_RTSP_SERVER (server), FALSE);
|
||||||
|
|
||||||
|
priv = server->priv;
|
||||||
|
|
||||||
|
GST_RTSP_SERVER_LOCK (server);
|
||||||
|
res = priv->use_client_settings;
|
||||||
|
GST_RTSP_SERVER_UNLOCK (server);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_rtsp_server_set_tls_certificate:
|
* gst_rtsp_server_set_tls_certificate:
|
||||||
* @server: a #GstRTSPServer
|
* @server: a #GstRTSPServer
|
||||||
|
@ -773,6 +837,10 @@ gst_rtsp_server_get_property (GObject * object, guint propid,
|
||||||
case PROP_MAX_THREADS:
|
case PROP_MAX_THREADS:
|
||||||
g_value_set_int (value, gst_rtsp_server_get_max_threads (server));
|
g_value_set_int (value, gst_rtsp_server_get_max_threads (server));
|
||||||
break;
|
break;
|
||||||
|
case PROP_USE_CLIENT_SETTINGS:
|
||||||
|
g_value_set_boolean (value,
|
||||||
|
gst_rtsp_server_get_use_client_settings (server));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -803,6 +871,10 @@ gst_rtsp_server_set_property (GObject * object, guint propid,
|
||||||
case PROP_MAX_THREADS:
|
case PROP_MAX_THREADS:
|
||||||
gst_rtsp_server_set_max_threads (server, g_value_get_int (value));
|
gst_rtsp_server_set_max_threads (server, g_value_get_int (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_USE_CLIENT_SETTINGS:
|
||||||
|
gst_rtsp_server_set_use_client_settings (server,
|
||||||
|
g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -1148,6 +1220,8 @@ default_create_client (GstRTSPServer * server)
|
||||||
gst_rtsp_client_set_mount_points (client, priv->mount_points);
|
gst_rtsp_client_set_mount_points (client, priv->mount_points);
|
||||||
/* set authentication manager */
|
/* set authentication manager */
|
||||||
gst_rtsp_client_set_auth (client, priv->auth);
|
gst_rtsp_client_set_auth (client, priv->auth);
|
||||||
|
/* check if client transport settings for multicast are allowed */
|
||||||
|
gst_rtsp_client_set_use_client_settings (client, priv->use_client_settings);
|
||||||
GST_RTSP_SERVER_UNLOCK (server);
|
GST_RTSP_SERVER_UNLOCK (server);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
|
|
@ -103,6 +103,10 @@ GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *serve
|
||||||
void gst_rtsp_server_set_max_threads (GstRTSPServer *server, gint max_threads);
|
void gst_rtsp_server_set_max_threads (GstRTSPServer *server, gint max_threads);
|
||||||
gint gst_rtsp_server_get_max_threads (GstRTSPServer *server);
|
gint gst_rtsp_server_get_max_threads (GstRTSPServer *server);
|
||||||
|
|
||||||
|
void gst_rtsp_server_set_use_client_settings (GstRTSPServer *server,
|
||||||
|
gboolean use_client_settings);
|
||||||
|
gboolean gst_rtsp_server_get_use_client_settings (GstRTSPServer *server);
|
||||||
|
|
||||||
void gst_rtsp_server_set_tls_certificate (GstRTSPServer *server, GTlsCertificate *cert);
|
void gst_rtsp_server_set_tls_certificate (GstRTSPServer *server, GTlsCertificate *cert);
|
||||||
GTlsCertificate * gst_rtsp_server_get_tls_certificate (GstRTSPServer *server);
|
GTlsCertificate * gst_rtsp_server_get_tls_certificate (GstRTSPServer *server);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue