mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +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;
|
||||
gint backlog;
|
||||
gint max_threads;
|
||||
gboolean use_client_settings;
|
||||
|
||||
GSocket *socket;
|
||||
|
||||
|
@ -65,6 +66,7 @@ struct _GstRTSPServerPrivate
|
|||
#define DEFAULT_SERVICE "8554"
|
||||
#define DEFAULT_BACKLOG 5
|
||||
#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
|
||||
* sooner. Disabled for now because it is not very well implemented by various
|
||||
|
@ -82,6 +84,7 @@ enum
|
|||
PROP_SESSION_POOL,
|
||||
PROP_MOUNT_POINTS,
|
||||
PROP_MAX_THREADS,
|
||||
PROP_USE_CLIENT_SETTINGS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
|
@ -206,6 +209,17 @@ gst_rtsp_server_class_init (GstRTSPServerClass * klass)
|
|||
"The maximum amount of threads to use for client connections "
|
||||
"(0 = only mainloop, -1 = unlimited)", -1, G_MAXINT,
|
||||
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] =
|
||||
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->mount_points = gst_rtsp_mount_points_new ();
|
||||
priv->max_threads = DEFAULT_MAX_THREADS;
|
||||
priv->use_client_settings = DEFAULT_USE_CLIENT_SETTINGS;
|
||||
g_queue_init (&priv->loops);
|
||||
}
|
||||
|
||||
|
@ -687,6 +702,55 @@ gst_rtsp_server_get_max_threads (GstRTSPServer * server)
|
|||
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:
|
||||
* @server: a #GstRTSPServer
|
||||
|
@ -773,6 +837,10 @@ gst_rtsp_server_get_property (GObject * object, guint propid,
|
|||
case PROP_MAX_THREADS:
|
||||
g_value_set_int (value, gst_rtsp_server_get_max_threads (server));
|
||||
break;
|
||||
case PROP_USE_CLIENT_SETTINGS:
|
||||
g_value_set_boolean (value,
|
||||
gst_rtsp_server_get_use_client_settings (server));
|
||||
break;
|
||||
default:
|
||||
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:
|
||||
gst_rtsp_server_set_max_threads (server, g_value_get_int (value));
|
||||
break;
|
||||
case PROP_USE_CLIENT_SETTINGS:
|
||||
gst_rtsp_server_set_use_client_settings (server,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
/* set authentication manager */
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
GTlsCertificate * gst_rtsp_server_get_tls_certificate (GstRTSPServer *server);
|
||||
|
||||
|
|
Loading…
Reference in a new issue