mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:46:13 +00:00
Revert "Add new API for setting/getting maximum multicast ttl value"
This reverts commit 7f0ae77e40
.
Commits where accidentially squashed together
This commit is contained in:
parent
17335e9906
commit
443c2b73e5
9 changed files with 129 additions and 452 deletions
|
@ -1981,27 +1981,26 @@ default_configure_client_transport (GstRTSPClient * client,
|
||||||
*/
|
*/
|
||||||
/* FIXME: could be more adequately solved by making it possible
|
/* FIXME: could be more adequately solved by making it possible
|
||||||
* to set a socket on multiudpsink after it has already been started */
|
* to set a socket on multiudpsink after it has already been started */
|
||||||
if (!gst_rtsp_stream_allocate_udp_sockets (ctx->stream,
|
if (!gst_rtsp_stream_allocate_udp_sockets (ctx->stream, G_SOCKET_FAMILY_IPV4, ct,
|
||||||
G_SOCKET_FAMILY_IPV4, ct, use_client_settings)
|
use_client_settings) && family == G_SOCKET_FAMILY_IPV4)
|
||||||
&& family == G_SOCKET_FAMILY_IPV4)
|
|
||||||
goto error_allocating_ports;
|
goto error_allocating_ports;
|
||||||
|
|
||||||
if (!gst_rtsp_stream_allocate_udp_sockets (ctx->stream,
|
if (!gst_rtsp_stream_allocate_udp_sockets (ctx->stream, G_SOCKET_FAMILY_IPV6, ct,
|
||||||
G_SOCKET_FAMILY_IPV6, ct, use_client_settings)
|
use_client_settings) && family == G_SOCKET_FAMILY_IPV6)
|
||||||
&& family == G_SOCKET_FAMILY_IPV6)
|
|
||||||
goto error_allocating_ports;
|
goto error_allocating_ports;
|
||||||
|
|
||||||
if (ct->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) {
|
if (ct->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) {
|
||||||
/* FIXME: the address has been successfully allocated, however, in
|
GstRTSPAddress *addr = NULL;
|
||||||
* the use_client_settings case we need to verify that the allocated
|
|
||||||
* address is the one requested by the client and if this address is
|
|
||||||
* an allowed destination. Verifying this via the address pool in not
|
|
||||||
* the proper way as the address pool should only be used for choosing
|
|
||||||
* the server-selected address/port pairs. */
|
|
||||||
|
|
||||||
if (!use_client_settings) {
|
if (use_client_settings) {
|
||||||
GstRTSPAddress *addr = NULL;
|
/* the address has been successfully allocated, let's check if it's
|
||||||
|
* the one requested by the client */
|
||||||
|
addr = gst_rtsp_stream_reserve_address (ctx->stream, ct->destination,
|
||||||
|
ct->port.min, ct->port.max - ct->port.min + 1, ct->ttl);
|
||||||
|
|
||||||
|
if (addr == NULL)
|
||||||
|
goto no_address;
|
||||||
|
} else {
|
||||||
g_free (ct->destination);
|
g_free (ct->destination);
|
||||||
addr = gst_rtsp_stream_get_multicast_address (ctx->stream, family);
|
addr = gst_rtsp_stream_get_multicast_address (ctx->stream, family);
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
|
@ -2010,8 +2009,9 @@ default_configure_client_transport (GstRTSPClient * client,
|
||||||
ct->port.min = addr->port;
|
ct->port.min = addr->port;
|
||||||
ct->port.max = addr->port + addr->n_ports - 1;
|
ct->port.max = addr->port + addr->n_ports - 1;
|
||||||
ct->ttl = addr->ttl;
|
ct->ttl = addr->ttl;
|
||||||
gst_rtsp_address_free (addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_rtsp_address_free (addr);
|
||||||
} else {
|
} else {
|
||||||
GstRTSPUrl *url;
|
GstRTSPUrl *url;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ struct _GstRTSPMediaFactoryPrivate
|
||||||
GstRTSPTransportMode transport_mode;
|
GstRTSPTransportMode transport_mode;
|
||||||
gboolean stop_on_disconnect;
|
gboolean stop_on_disconnect;
|
||||||
gchar *multicast_iface;
|
gchar *multicast_iface;
|
||||||
guint max_mcast_ttl;
|
|
||||||
|
|
||||||
GstClockTime rtx_time;
|
GstClockTime rtx_time;
|
||||||
guint latency;
|
guint latency;
|
||||||
|
@ -84,7 +83,6 @@ struct _GstRTSPMediaFactoryPrivate
|
||||||
GST_RTSP_LOWER_TRANS_TCP
|
GST_RTSP_LOWER_TRANS_TCP
|
||||||
#define DEFAULT_BUFFER_SIZE 0x80000
|
#define DEFAULT_BUFFER_SIZE 0x80000
|
||||||
#define DEFAULT_LATENCY 200
|
#define DEFAULT_LATENCY 200
|
||||||
#define DEFAULT_MAX_MCAST_TTL 255
|
|
||||||
#define DEFAULT_TRANSPORT_MODE GST_RTSP_TRANSPORT_MODE_PLAY
|
#define DEFAULT_TRANSPORT_MODE GST_RTSP_TRANSPORT_MODE_PLAY
|
||||||
#define DEFAULT_STOP_ON_DISCONNECT TRUE
|
#define DEFAULT_STOP_ON_DISCONNECT TRUE
|
||||||
#define DEFAULT_DO_RETRANSMISSION FALSE
|
#define DEFAULT_DO_RETRANSMISSION FALSE
|
||||||
|
@ -103,7 +101,6 @@ enum
|
||||||
PROP_TRANSPORT_MODE,
|
PROP_TRANSPORT_MODE,
|
||||||
PROP_STOP_ON_DISCONNECT,
|
PROP_STOP_ON_DISCONNECT,
|
||||||
PROP_CLOCK,
|
PROP_CLOCK,
|
||||||
PROP_MAX_MCAST_TTL,
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -225,12 +222,6 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
|
||||||
"medias of this factory", GST_TYPE_CLOCK,
|
"medias of this factory", GST_TYPE_CLOCK,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MAX_MCAST_TTL,
|
|
||||||
g_param_spec_uint ("max-mcast-ttl", "Maximum multicast ttl",
|
|
||||||
"The maximum time-to-live value of outgoing multicast packets", 1,
|
|
||||||
255, DEFAULT_MAX_MCAST_TTL,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
gst_rtsp_media_factory_signals[SIGNAL_MEDIA_CONSTRUCTED] =
|
gst_rtsp_media_factory_signals[SIGNAL_MEDIA_CONSTRUCTED] =
|
||||||
g_signal_new ("media-constructed", G_TYPE_FROM_CLASS (klass),
|
g_signal_new ("media-constructed", G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPMediaFactoryClass,
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPMediaFactoryClass,
|
||||||
|
@ -272,7 +263,6 @@ gst_rtsp_media_factory_init (GstRTSPMediaFactory * factory)
|
||||||
priv->stop_on_disconnect = DEFAULT_STOP_ON_DISCONNECT;
|
priv->stop_on_disconnect = DEFAULT_STOP_ON_DISCONNECT;
|
||||||
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
||||||
priv->do_retransmission = DEFAULT_DO_RETRANSMISSION;
|
priv->do_retransmission = DEFAULT_DO_RETRANSMISSION;
|
||||||
priv->max_mcast_ttl = DEFAULT_MAX_MCAST_TTL;
|
|
||||||
|
|
||||||
g_mutex_init (&priv->lock);
|
g_mutex_init (&priv->lock);
|
||||||
g_mutex_init (&priv->medias_lock);
|
g_mutex_init (&priv->medias_lock);
|
||||||
|
@ -347,9 +337,6 @@ gst_rtsp_media_factory_get_property (GObject * object, guint propid,
|
||||||
case PROP_CLOCK:
|
case PROP_CLOCK:
|
||||||
g_value_take_object (value, gst_rtsp_media_factory_get_clock (factory));
|
g_value_take_object (value, gst_rtsp_media_factory_get_clock (factory));
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_MCAST_TTL:
|
|
||||||
g_value_set_uint (value,
|
|
||||||
gst_rtsp_media_factory_get_max_mcast_ttl (factory));
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -400,9 +387,6 @@ gst_rtsp_media_factory_set_property (GObject * object, guint propid,
|
||||||
case PROP_CLOCK:
|
case PROP_CLOCK:
|
||||||
gst_rtsp_media_factory_set_clock (factory, g_value_get_object (value));
|
gst_rtsp_media_factory_set_clock (factory, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_MCAST_TTL:
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (factory,
|
|
||||||
g_value_get_uint (value));
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -1479,62 +1463,6 @@ gst_rtsp_media_factory_get_publish_clock_mode (GstRTSPMediaFactory * factory)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_media_factory_set_max_mcast_ttl:
|
|
||||||
* @factory: a #GstRTSPMedia
|
|
||||||
* @ttl: the new multicast ttl value
|
|
||||||
*
|
|
||||||
* Set the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the requested ttl has been set successfully.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (GstRTSPMediaFactory * factory,
|
|
||||||
guint ttl)
|
|
||||||
{
|
|
||||||
GstRTSPMediaFactoryPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), FALSE);
|
|
||||||
|
|
||||||
priv = factory->priv;
|
|
||||||
|
|
||||||
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
|
|
||||||
if (ttl == 0 || ttl > DEFAULT_MAX_MCAST_TTL) {
|
|
||||||
GST_WARNING_OBJECT (factory, "The requested mcast TTL value is not valid.");
|
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
priv->max_mcast_ttl = ttl;
|
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_media_factory_get_max_mcast_ttl:
|
|
||||||
* @factory: a #GstRTSPMedia
|
|
||||||
*
|
|
||||||
* Get the the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*/
|
|
||||||
guint
|
|
||||||
gst_rtsp_media_factory_get_max_mcast_ttl (GstRTSPMediaFactory * factory)
|
|
||||||
{
|
|
||||||
GstRTSPMediaFactoryPrivate *priv;
|
|
||||||
guint result;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), 0);
|
|
||||||
|
|
||||||
priv = factory->priv;
|
|
||||||
|
|
||||||
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
|
|
||||||
result = priv->max_mcast_ttl;
|
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
default_gen_key (GstRTSPMediaFactory * factory, const GstRTSPUrl * url)
|
default_gen_key (GstRTSPMediaFactory * factory, const GstRTSPUrl * url)
|
||||||
{
|
{
|
||||||
|
@ -1685,7 +1613,6 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
gchar *multicast_iface;
|
gchar *multicast_iface;
|
||||||
GstRTSPPublishClockMode publish_clock_mode;
|
GstRTSPPublishClockMode publish_clock_mode;
|
||||||
guint ttl;
|
|
||||||
|
|
||||||
/* configure the sharedness */
|
/* configure the sharedness */
|
||||||
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
|
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
|
||||||
|
@ -1701,7 +1628,6 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
|
||||||
stop_on_disconnect = priv->stop_on_disconnect;
|
stop_on_disconnect = priv->stop_on_disconnect;
|
||||||
clock = priv->clock ? gst_object_ref (priv->clock) : NULL;
|
clock = priv->clock ? gst_object_ref (priv->clock) : NULL;
|
||||||
publish_clock_mode = priv->publish_clock_mode;
|
publish_clock_mode = priv->publish_clock_mode;
|
||||||
ttl = priv->max_mcast_ttl;
|
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
||||||
|
|
||||||
gst_rtsp_media_set_suspend_mode (media, suspend_mode);
|
gst_rtsp_media_set_suspend_mode (media, suspend_mode);
|
||||||
|
@ -1716,7 +1642,6 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
|
||||||
gst_rtsp_media_set_transport_mode (media, transport_mode);
|
gst_rtsp_media_set_transport_mode (media, transport_mode);
|
||||||
gst_rtsp_media_set_stop_on_disconnect (media, stop_on_disconnect);
|
gst_rtsp_media_set_stop_on_disconnect (media, stop_on_disconnect);
|
||||||
gst_rtsp_media_set_publish_clock_mode (media, publish_clock_mode);
|
gst_rtsp_media_set_publish_clock_mode (media, publish_clock_mode);
|
||||||
gst_rtsp_media_set_max_mcast_ttl (media, ttl);
|
|
||||||
|
|
||||||
if (clock) {
|
if (clock) {
|
||||||
gst_rtsp_media_set_clock (media, clock);
|
gst_rtsp_media_set_clock (media, clock);
|
||||||
|
|
|
@ -239,13 +239,6 @@ void gst_rtsp_media_factory_set_publish_clock_mode (GstRTSPMe
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
GstRTSPPublishClockMode gst_rtsp_media_factory_get_publish_clock_mode (GstRTSPMediaFactory * factory);
|
GstRTSPPublishClockMode gst_rtsp_media_factory_get_publish_clock_mode (GstRTSPMediaFactory * factory);
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
gboolean gst_rtsp_media_factory_set_max_mcast_ttl (GstRTSPMediaFactory * factory,
|
|
||||||
guint ttl);
|
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
guint gst_rtsp_media_factory_get_max_mcast_ttl (GstRTSPMediaFactory * factory);
|
|
||||||
|
|
||||||
/* creating the media from the factory and a url */
|
/* creating the media from the factory and a url */
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
|
|
|
@ -98,7 +98,6 @@ struct _GstRTSPMediaPrivate
|
||||||
guint buffer_size;
|
guint buffer_size;
|
||||||
GstRTSPAddressPool *pool;
|
GstRTSPAddressPool *pool;
|
||||||
gchar *multicast_iface;
|
gchar *multicast_iface;
|
||||||
guint max_mcast_ttl;
|
|
||||||
gboolean blocked;
|
gboolean blocked;
|
||||||
GstRTSPTransportMode transport_mode;
|
GstRTSPTransportMode transport_mode;
|
||||||
gboolean stop_on_disconnect;
|
gboolean stop_on_disconnect;
|
||||||
|
@ -159,7 +158,6 @@ struct _GstRTSPMediaPrivate
|
||||||
#define DEFAULT_LATENCY 200
|
#define DEFAULT_LATENCY 200
|
||||||
#define DEFAULT_TRANSPORT_MODE GST_RTSP_TRANSPORT_MODE_PLAY
|
#define DEFAULT_TRANSPORT_MODE GST_RTSP_TRANSPORT_MODE_PLAY
|
||||||
#define DEFAULT_STOP_ON_DISCONNECT TRUE
|
#define DEFAULT_STOP_ON_DISCONNECT TRUE
|
||||||
#define DEFAULT_MAX_MCAST_TTL 255
|
|
||||||
|
|
||||||
#define DEFAULT_DO_RETRANSMISSION FALSE
|
#define DEFAULT_DO_RETRANSMISSION FALSE
|
||||||
|
|
||||||
|
@ -182,7 +180,6 @@ enum
|
||||||
PROP_TRANSPORT_MODE,
|
PROP_TRANSPORT_MODE,
|
||||||
PROP_STOP_ON_DISCONNECT,
|
PROP_STOP_ON_DISCONNECT,
|
||||||
PROP_CLOCK,
|
PROP_CLOCK,
|
||||||
PROP_MAX_MCAST_TTL,
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -378,12 +375,6 @@ gst_rtsp_media_class_init (GstRTSPMediaClass * klass)
|
||||||
"Clock to be used by the media pipeline",
|
"Clock to be used by the media pipeline",
|
||||||
GST_TYPE_CLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
GST_TYPE_CLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MAX_MCAST_TTL,
|
|
||||||
g_param_spec_uint ("max-mcast-ttl", "Maximum multicast ttl",
|
|
||||||
"The maximum time-to-live value of outgoing multicast packets", 1,
|
|
||||||
255, DEFAULT_MAX_MCAST_TTL,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
gst_rtsp_media_signals[SIGNAL_NEW_STREAM] =
|
gst_rtsp_media_signals[SIGNAL_NEW_STREAM] =
|
||||||
g_signal_new ("new-stream", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
g_signal_new ("new-stream", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GstRTSPMediaClass, new_stream), NULL, NULL,
|
G_STRUCT_OFFSET (GstRTSPMediaClass, new_stream), NULL, NULL,
|
||||||
|
@ -454,7 +445,6 @@ gst_rtsp_media_init (GstRTSPMedia * media)
|
||||||
priv->stop_on_disconnect = DEFAULT_STOP_ON_DISCONNECT;
|
priv->stop_on_disconnect = DEFAULT_STOP_ON_DISCONNECT;
|
||||||
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
||||||
priv->do_retransmission = DEFAULT_DO_RETRANSMISSION;
|
priv->do_retransmission = DEFAULT_DO_RETRANSMISSION;
|
||||||
priv->max_mcast_ttl = DEFAULT_MAX_MCAST_TTL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -541,9 +531,6 @@ gst_rtsp_media_get_property (GObject * object, guint propid,
|
||||||
case PROP_CLOCK:
|
case PROP_CLOCK:
|
||||||
g_value_take_object (value, gst_rtsp_media_get_clock (media));
|
g_value_take_object (value, gst_rtsp_media_get_clock (media));
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_MCAST_TTL:
|
|
||||||
g_value_set_uint (value, gst_rtsp_media_get_max_mcast_ttl (media));
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -597,9 +584,6 @@ gst_rtsp_media_set_property (GObject * object, guint propid,
|
||||||
case PROP_CLOCK:
|
case PROP_CLOCK:
|
||||||
gst_rtsp_media_set_clock (media, g_value_get_object (value));
|
gst_rtsp_media_set_clock (media, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_MCAST_TTL:
|
|
||||||
gst_rtsp_media_set_max_mcast_ttl (media, g_value_get_uint (value));
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
|
||||||
}
|
}
|
||||||
|
@ -1839,70 +1823,6 @@ gst_rtsp_media_get_multicast_iface (GstRTSPMedia * media)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_media_set_max_mcast_ttl:
|
|
||||||
* @media: a #GstRTSPMedia
|
|
||||||
* @ttl: the new multicast ttl value
|
|
||||||
*
|
|
||||||
* Set the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the requested ttl has been set successfully.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_rtsp_media_set_max_mcast_ttl (GstRTSPMedia * media, guint ttl)
|
|
||||||
{
|
|
||||||
GstRTSPMediaPrivate *priv;
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (media, "set max mcast ttl %u", ttl);
|
|
||||||
|
|
||||||
priv = media->priv;
|
|
||||||
|
|
||||||
g_mutex_lock (&priv->lock);
|
|
||||||
|
|
||||||
if (ttl == 0 || ttl > DEFAULT_MAX_MCAST_TTL) {
|
|
||||||
GST_WARNING_OBJECT (media, "The reqested mcast TTL value is not valid.");
|
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
priv->max_mcast_ttl = ttl;
|
|
||||||
|
|
||||||
for (i = 0; i < priv->streams->len; i++) {
|
|
||||||
GstRTSPStream *stream = g_ptr_array_index (priv->streams, i);
|
|
||||||
gst_rtsp_stream_set_max_mcast_ttl (stream, ttl);
|
|
||||||
}
|
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_media_get_max_mcast_ttl:
|
|
||||||
* @media: a #GstRTSPMedia
|
|
||||||
*
|
|
||||||
* Get the the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*/
|
|
||||||
guint
|
|
||||||
gst_rtsp_media_get_max_mcast_ttl (GstRTSPMedia * media)
|
|
||||||
{
|
|
||||||
GstRTSPMediaPrivate *priv;
|
|
||||||
guint res;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
|
|
||||||
|
|
||||||
priv = media->priv;
|
|
||||||
|
|
||||||
g_mutex_lock (&priv->lock);
|
|
||||||
res = priv->max_mcast_ttl;
|
|
||||||
g_mutex_unlock (&priv->lock);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
_find_payload_types (GstRTSPMedia * media)
|
_find_payload_types (GstRTSPMedia * media)
|
||||||
{
|
{
|
||||||
|
@ -2220,7 +2140,6 @@ gst_rtsp_media_create_stream (GstRTSPMedia * media, GstElement * payloader,
|
||||||
if (priv->pool)
|
if (priv->pool)
|
||||||
gst_rtsp_stream_set_address_pool (stream, priv->pool);
|
gst_rtsp_stream_set_address_pool (stream, priv->pool);
|
||||||
gst_rtsp_stream_set_multicast_iface (stream, priv->multicast_iface);
|
gst_rtsp_stream_set_multicast_iface (stream, priv->multicast_iface);
|
||||||
gst_rtsp_stream_set_max_mcast_ttl (stream, priv->max_mcast_ttl);
|
|
||||||
gst_rtsp_stream_set_profiles (stream, priv->profiles);
|
gst_rtsp_stream_set_profiles (stream, priv->profiles);
|
||||||
gst_rtsp_stream_set_protocols (stream, priv->protocols);
|
gst_rtsp_stream_set_protocols (stream, priv->protocols);
|
||||||
gst_rtsp_stream_set_retransmission_time (stream, priv->rtx_time);
|
gst_rtsp_stream_set_retransmission_time (stream, priv->rtx_time);
|
||||||
|
|
|
@ -314,12 +314,6 @@ void gst_rtsp_media_set_publish_clock_mode (GstRTSPMedia * me
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
GstRTSPPublishClockMode gst_rtsp_media_get_publish_clock_mode (GstRTSPMedia * media);
|
GstRTSPPublishClockMode gst_rtsp_media_get_publish_clock_mode (GstRTSPMedia * media);
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
gboolean gst_rtsp_media_set_max_mcast_ttl (GstRTSPMedia *media, guint ttl);
|
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
guint gst_rtsp_media_get_max_mcast_ttl (GstRTSPMedia *media);
|
|
||||||
|
|
||||||
/* prepare the media for playback */
|
/* prepare the media for playback */
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
|
|
|
@ -145,7 +145,6 @@ struct _GstRTSPStreamPrivate
|
||||||
GstRTSPAddress *mcast_addr_v6;
|
GstRTSPAddress *mcast_addr_v6;
|
||||||
|
|
||||||
gchar *multicast_iface;
|
gchar *multicast_iface;
|
||||||
guint max_mcast_ttl;
|
|
||||||
|
|
||||||
/* the caps of the stream */
|
/* the caps of the stream */
|
||||||
gulong caps_sig;
|
gulong caps_sig;
|
||||||
|
@ -182,7 +181,6 @@ struct _GstRTSPStreamPrivate
|
||||||
#define DEFAULT_PROFILES GST_RTSP_PROFILE_AVP
|
#define DEFAULT_PROFILES GST_RTSP_PROFILE_AVP
|
||||||
#define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | \
|
#define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | \
|
||||||
GST_RTSP_LOWER_TRANS_TCP
|
GST_RTSP_LOWER_TRANS_TCP
|
||||||
#define DEFAULT_MAX_MCAST_TTL 255
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -282,7 +280,6 @@ gst_rtsp_stream_init (GstRTSPStream * stream)
|
||||||
priv->allowed_protocols = DEFAULT_PROTOCOLS;
|
priv->allowed_protocols = DEFAULT_PROTOCOLS;
|
||||||
priv->configured_protocols = 0;
|
priv->configured_protocols = 0;
|
||||||
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
priv->publish_clock_mode = GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK;
|
||||||
priv->max_mcast_ttl = DEFAULT_MAX_MCAST_TTL;
|
|
||||||
|
|
||||||
g_mutex_init (&priv->lock);
|
g_mutex_init (&priv->lock);
|
||||||
|
|
||||||
|
@ -1887,54 +1884,6 @@ gst_rtsp_stream_get_buffer_size (GstRTSPStream * stream)
|
||||||
return buffer_size;
|
return buffer_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_stream_set_max_mcast_ttl:
|
|
||||||
* @stream: a #GstRTSPStream
|
|
||||||
* @ttl: the new multicast ttl value
|
|
||||||
*
|
|
||||||
* Set the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the requested ttl has been set successfully.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_rtsp_stream_set_max_mcast_ttl (GstRTSPStream * stream, guint ttl)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE);
|
|
||||||
|
|
||||||
g_mutex_lock (&stream->priv->lock);
|
|
||||||
if (ttl == 0 || ttl > DEFAULT_MAX_MCAST_TTL) {
|
|
||||||
GST_WARNING_OBJECT (stream, "The reqested mcast TTL value is not valid.");
|
|
||||||
g_mutex_unlock (&stream->priv->lock);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
stream->priv->max_mcast_ttl = ttl;
|
|
||||||
g_mutex_unlock (&stream->priv->lock);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_rtsp_stream_get_max_mcast_ttl:
|
|
||||||
* @stream: a #GstRTSPStream
|
|
||||||
*
|
|
||||||
* Get the the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
* Returns: the maximum time-to-live value of outgoing multicast packets.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
guint
|
|
||||||
gst_rtsp_stream_get_max_mcast_ttl (GstRTSPStream * stream)
|
|
||||||
{
|
|
||||||
guint ttl;
|
|
||||||
|
|
||||||
g_mutex_lock (&stream->priv->lock);
|
|
||||||
ttl = stream->priv->max_mcast_ttl;
|
|
||||||
g_mutex_unlock (&stream->priv->lock);
|
|
||||||
|
|
||||||
return ttl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* executed from streaming thread */
|
/* executed from streaming thread */
|
||||||
static void
|
static void
|
||||||
caps_notify (GstPad * pad, GParamSpec * unused, GstRTSPStream * stream)
|
caps_notify (GstPad * pad, GParamSpec * unused, GstRTSPStream * stream)
|
||||||
|
|
|
@ -292,12 +292,6 @@ void gst_rtsp_stream_set_publish_clock_mode (GstRTSPStream *
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
GstRTSPPublishClockMode gst_rtsp_stream_get_publish_clock_mode (GstRTSPStream * stream);
|
GstRTSPPublishClockMode gst_rtsp_stream_get_publish_clock_mode (GstRTSPStream * stream);
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
gboolean gst_rtsp_stream_set_max_mcast_ttl (GstRTSPStream *stream, guint ttl);
|
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
|
||||||
guint gst_rtsp_stream_get_max_mcast_ttl (GstRTSPStream *stream);
|
|
||||||
|
|
||||||
GST_RTSP_SERVER_API
|
GST_RTSP_SERVER_API
|
||||||
gboolean gst_rtsp_stream_complete_stream (GstRTSPStream * stream, const GstRTSPTransport * transport);
|
gboolean gst_rtsp_stream_complete_stream (GstRTSPStream * stream, const GstRTSPTransport * transport);
|
||||||
|
|
||||||
|
|
|
@ -525,6 +525,7 @@ test_setup_response_200_multicast (GstRTSPClient * client,
|
||||||
session_pool = gst_rtsp_client_get_session_pool (client);
|
session_pool = gst_rtsp_client_get_session_pool (client);
|
||||||
fail_unless (session_pool != NULL);
|
fail_unless (session_pool != NULL);
|
||||||
|
|
||||||
|
fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 1);
|
||||||
session = gst_rtsp_session_pool_find (session_pool, session_hdr_params[0]);
|
session = gst_rtsp_session_pool_find (session_pool, session_hdr_params[0]);
|
||||||
g_strfreev (session_hdr_params);
|
g_strfreev (session_hdr_params);
|
||||||
|
|
||||||
|
@ -726,6 +727,117 @@ GST_START_TEST (test_client_multicast_ignore_transport_specific)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
test_setup_response_461 (GstRTSPClient * client,
|
||||||
|
GstRTSPMessage * response, gboolean close, gpointer user_data)
|
||||||
|
{
|
||||||
|
GstRTSPStatusCode code;
|
||||||
|
const gchar *reason;
|
||||||
|
GstRTSPVersion version;
|
||||||
|
gchar *str;
|
||||||
|
|
||||||
|
fail_unless (expected_transport == NULL);
|
||||||
|
|
||||||
|
fail_unless (gst_rtsp_message_get_type (response) ==
|
||||||
|
GST_RTSP_MESSAGE_RESPONSE);
|
||||||
|
|
||||||
|
fail_unless (gst_rtsp_message_parse_response (response, &code, &reason,
|
||||||
|
&version)
|
||||||
|
== GST_RTSP_OK);
|
||||||
|
fail_unless (code == GST_RTSP_STS_UNSUPPORTED_TRANSPORT);
|
||||||
|
fail_unless (g_str_equal (reason, "Unsupported transport"));
|
||||||
|
fail_unless (version == GST_RTSP_VERSION_1_0);
|
||||||
|
|
||||||
|
fail_unless (gst_rtsp_message_get_header (response, GST_RTSP_HDR_CSEQ, &str,
|
||||||
|
0) == GST_RTSP_OK);
|
||||||
|
fail_unless (atoi (str) == cseq++);
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_START_TEST (test_client_multicast_invalid_transport_specific)
|
||||||
|
{
|
||||||
|
GstRTSPClient *client;
|
||||||
|
GstRTSPMessage request = { 0, };
|
||||||
|
gchar *str;
|
||||||
|
GstRTSPSessionPool *session_pool;
|
||||||
|
GstRTSPContext ctx = { NULL };
|
||||||
|
|
||||||
|
client = setup_multicast_client ();
|
||||||
|
|
||||||
|
ctx.client = client;
|
||||||
|
ctx.auth = gst_rtsp_auth_new ();
|
||||||
|
ctx.token =
|
||||||
|
gst_rtsp_token_new (GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS,
|
||||||
|
G_TYPE_BOOLEAN, TRUE, GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE, G_TYPE_STRING,
|
||||||
|
"user", NULL);
|
||||||
|
gst_rtsp_context_push_current (&ctx);
|
||||||
|
|
||||||
|
/* simple SETUP with a valid URI and multicast, but an invalid ip */
|
||||||
|
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
||||||
|
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
||||||
|
str = g_strdup_printf ("%d", cseq);
|
||||||
|
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
|
||||||
|
"RTP/AVP;multicast;destination=233.252.0.2;ttl=1;port=5000-5001;");
|
||||||
|
|
||||||
|
gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
|
||||||
|
fail_unless (gst_rtsp_client_handle_message (client,
|
||||||
|
&request) == GST_RTSP_OK);
|
||||||
|
gst_rtsp_message_unset (&request);
|
||||||
|
|
||||||
|
session_pool = gst_rtsp_client_get_session_pool (client);
|
||||||
|
fail_unless (session_pool != NULL);
|
||||||
|
fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0);
|
||||||
|
g_object_unref (session_pool);
|
||||||
|
|
||||||
|
|
||||||
|
/* simple SETUP with a valid URI and multicast, but an invalid prt */
|
||||||
|
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
||||||
|
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
||||||
|
str = g_strdup_printf ("%d", cseq);
|
||||||
|
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
|
||||||
|
"RTP/AVP;multicast;destination=233.252.0.1;ttl=1;port=6000-6001;");
|
||||||
|
|
||||||
|
gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
|
||||||
|
fail_unless (gst_rtsp_client_handle_message (client,
|
||||||
|
&request) == GST_RTSP_OK);
|
||||||
|
gst_rtsp_message_unset (&request);
|
||||||
|
|
||||||
|
session_pool = gst_rtsp_client_get_session_pool (client);
|
||||||
|
fail_unless (session_pool != NULL);
|
||||||
|
fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0);
|
||||||
|
g_object_unref (session_pool);
|
||||||
|
|
||||||
|
|
||||||
|
/* simple SETUP with a valid URI and multicast, but an invalid ttl */
|
||||||
|
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
||||||
|
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
||||||
|
str = g_strdup_printf ("%d", cseq);
|
||||||
|
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
||||||
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
|
||||||
|
"RTP/AVP;multicast;destination=233.252.0.1;ttl=2;port=5000-5001;");
|
||||||
|
|
||||||
|
gst_rtsp_client_set_send_func (client, test_setup_response_461, NULL, NULL);
|
||||||
|
fail_unless (gst_rtsp_client_handle_message (client,
|
||||||
|
&request) == GST_RTSP_OK);
|
||||||
|
gst_rtsp_message_unset (&request);
|
||||||
|
|
||||||
|
session_pool = gst_rtsp_client_get_session_pool (client);
|
||||||
|
fail_unless (session_pool != NULL);
|
||||||
|
fail_unless (gst_rtsp_session_pool_get_n_sessions (session_pool) == 0);
|
||||||
|
g_object_unref (session_pool);
|
||||||
|
|
||||||
|
teardown_client (client);
|
||||||
|
g_object_unref (ctx.auth);
|
||||||
|
gst_rtsp_token_unref (ctx.token);
|
||||||
|
gst_rtsp_context_pop_current (&ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_client_multicast_transport_specific)
|
GST_START_TEST (test_client_multicast_transport_specific)
|
||||||
{
|
{
|
||||||
GstRTSPClient *client;
|
GstRTSPClient *client;
|
||||||
|
@ -747,7 +859,7 @@ GST_START_TEST (test_client_multicast_transport_specific)
|
||||||
expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
|
expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
|
||||||
"ttl=1;port=5000-5001;mode=\"PLAY\"";
|
"ttl=1;port=5000-5001;mode=\"PLAY\"";
|
||||||
|
|
||||||
/* simple SETUP with a valid URI */
|
/* simple SETUP with a valid URI and multicast, but an invalid ip */
|
||||||
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
||||||
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
||||||
str = g_strdup_printf ("%d", cseq);
|
str = g_strdup_printf ("%d", cseq);
|
||||||
|
@ -919,156 +1031,6 @@ GST_START_TEST (test_client_sdp_with_no_bitrate_tags)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static void
|
|
||||||
mcast_transport_specific_two_clients (gboolean shared)
|
|
||||||
{
|
|
||||||
GstRTSPClient *client, *client2;
|
|
||||||
GstRTSPMessage request = { 0, };
|
|
||||||
gchar *str;
|
|
||||||
GstRTSPSessionPool *session_pool;
|
|
||||||
GstRTSPContext ctx = { NULL };
|
|
||||||
GstRTSPContext ctx2 = { NULL };
|
|
||||||
GstRTSPMountPoints *mount_points;
|
|
||||||
GstRTSPMediaFactory *factory;
|
|
||||||
GstRTSPAddressPool *address_pool;
|
|
||||||
GstRTSPThreadPool *thread_pool;
|
|
||||||
gchar *session_id1;
|
|
||||||
|
|
||||||
mount_points = gst_rtsp_mount_points_new ();
|
|
||||||
factory = gst_rtsp_media_factory_new ();
|
|
||||||
if (shared)
|
|
||||||
gst_rtsp_media_factory_set_shared (factory, TRUE);
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (factory, 5);
|
|
||||||
gst_rtsp_media_factory_set_launch (factory,
|
|
||||||
"audiotestsrc ! audio/x-raw,rate=44100 ! audioconvert ! rtpL16pay name=pay0");
|
|
||||||
address_pool = gst_rtsp_address_pool_new ();
|
|
||||||
fail_unless (gst_rtsp_address_pool_add_range (address_pool,
|
|
||||||
"233.252.0.1", "233.252.0.1", 5000, 5001, 1));
|
|
||||||
gst_rtsp_media_factory_set_address_pool (factory, address_pool);
|
|
||||||
gst_rtsp_media_factory_add_role (factory, "user",
|
|
||||||
"media.factory.access", G_TYPE_BOOLEAN, TRUE,
|
|
||||||
"media.factory.construct", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
||||||
gst_rtsp_mount_points_add_factory (mount_points, "/test", factory);
|
|
||||||
session_pool = gst_rtsp_session_pool_new ();
|
|
||||||
thread_pool = gst_rtsp_thread_pool_new ();
|
|
||||||
|
|
||||||
/* first multicast client with transport specific request */
|
|
||||||
client = gst_rtsp_client_new ();
|
|
||||||
gst_rtsp_client_set_session_pool (client, session_pool);
|
|
||||||
gst_rtsp_client_set_mount_points (client, mount_points);
|
|
||||||
gst_rtsp_client_set_thread_pool (client, thread_pool);
|
|
||||||
|
|
||||||
ctx.client = client;
|
|
||||||
ctx.auth = gst_rtsp_auth_new ();
|
|
||||||
ctx.token =
|
|
||||||
gst_rtsp_token_new (GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS,
|
|
||||||
G_TYPE_BOOLEAN, TRUE, GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE, G_TYPE_STRING,
|
|
||||||
"user", NULL);
|
|
||||||
gst_rtsp_context_push_current (&ctx);
|
|
||||||
|
|
||||||
expected_transport = "RTP/AVP;multicast;destination=233.252.0.1;"
|
|
||||||
"ttl=1;port=5000-5001;mode=\"PLAY\"";
|
|
||||||
|
|
||||||
/* send SETUP request */
|
|
||||||
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
|
||||||
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
|
||||||
str = g_strdup_printf ("%d", cseq);
|
|
||||||
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
|
|
||||||
expected_transport);
|
|
||||||
|
|
||||||
gst_rtsp_client_set_send_func (client, test_setup_response_200_multicast,
|
|
||||||
NULL, NULL);
|
|
||||||
fail_unless (gst_rtsp_client_handle_message (client,
|
|
||||||
&request) == GST_RTSP_OK);
|
|
||||||
gst_rtsp_message_unset (&request);
|
|
||||||
expected_transport = NULL;
|
|
||||||
|
|
||||||
/* send PLAY request */
|
|
||||||
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_PLAY,
|
|
||||||
"rtsp://localhost/test") == GST_RTSP_OK);
|
|
||||||
str = g_strdup_printf ("%d", cseq);
|
|
||||||
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SESSION, session_id);
|
|
||||||
gst_rtsp_client_set_send_func (client, test_response_200, NULL, NULL);
|
|
||||||
fail_unless (gst_rtsp_client_handle_message (client,
|
|
||||||
&request) == GST_RTSP_OK);
|
|
||||||
gst_rtsp_message_unset (&request);
|
|
||||||
gst_rtsp_context_pop_current (&ctx);
|
|
||||||
session_id1 = session_id;
|
|
||||||
|
|
||||||
/* second multicast client with transport specific request */
|
|
||||||
cseq = 0;
|
|
||||||
client2 = gst_rtsp_client_new ();
|
|
||||||
gst_rtsp_client_set_session_pool (client2, session_pool);
|
|
||||||
gst_rtsp_client_set_mount_points (client2, mount_points);
|
|
||||||
gst_rtsp_client_set_thread_pool (client2, thread_pool);
|
|
||||||
|
|
||||||
ctx2.client = client2;
|
|
||||||
ctx2.auth = gst_rtsp_auth_new ();
|
|
||||||
ctx2.token =
|
|
||||||
gst_rtsp_token_new (GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS,
|
|
||||||
G_TYPE_BOOLEAN, TRUE, GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE, G_TYPE_STRING,
|
|
||||||
"user", NULL);
|
|
||||||
gst_rtsp_context_push_current (&ctx2);
|
|
||||||
|
|
||||||
expected_transport = "RTP/AVP;multicast;destination=233.252.0.2;"
|
|
||||||
"ttl=1;port=5002-5003;mode=\"PLAY\"";
|
|
||||||
|
|
||||||
/* send SETUP request */
|
|
||||||
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
|
||||||
"rtsp://localhost/test/stream=0") == GST_RTSP_OK);
|
|
||||||
str = g_strdup_printf ("%d", cseq);
|
|
||||||
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT,
|
|
||||||
expected_transport);
|
|
||||||
|
|
||||||
gst_rtsp_client_set_send_func (client2, test_setup_response_200_multicast,
|
|
||||||
NULL, NULL);
|
|
||||||
fail_unless (gst_rtsp_client_handle_message (client2,
|
|
||||||
&request) == GST_RTSP_OK);
|
|
||||||
gst_rtsp_message_unset (&request);
|
|
||||||
expected_transport = NULL;
|
|
||||||
|
|
||||||
/* send PLAY request */
|
|
||||||
fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_PLAY,
|
|
||||||
"rtsp://localhost/test") == GST_RTSP_OK);
|
|
||||||
str = g_strdup_printf ("%d", cseq);
|
|
||||||
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_CSEQ, str);
|
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SESSION, session_id);
|
|
||||||
gst_rtsp_client_set_send_func (client2, test_response_200, NULL, NULL);
|
|
||||||
fail_unless (gst_rtsp_client_handle_message (client2,
|
|
||||||
&request) == GST_RTSP_OK);
|
|
||||||
gst_rtsp_message_unset (&request);
|
|
||||||
|
|
||||||
send_teardown (client2);
|
|
||||||
gst_rtsp_context_pop_current (&ctx2);
|
|
||||||
|
|
||||||
gst_rtsp_context_push_current (&ctx);
|
|
||||||
session_id = session_id1;
|
|
||||||
send_teardown (client);
|
|
||||||
gst_rtsp_context_pop_current (&ctx);
|
|
||||||
|
|
||||||
teardown_client (client);
|
|
||||||
teardown_client (client2);
|
|
||||||
g_object_unref (ctx.auth);
|
|
||||||
g_object_unref (ctx2.auth);
|
|
||||||
gst_rtsp_token_unref (ctx.token);
|
|
||||||
gst_rtsp_token_unref (ctx2.token);
|
|
||||||
g_object_unref (mount_points);
|
|
||||||
g_object_unref (session_pool);
|
|
||||||
g_object_unref (address_pool);
|
|
||||||
g_object_unref (thread_pool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* test if two multicast clients can choose different transport settings */
|
|
||||||
GST_START_TEST
|
|
||||||
(test_client_multicast_transport_specific_two_clients_shared_media) {
|
|
||||||
mcast_transport_specific_two_clients (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
rtspclient_suite (void)
|
rtspclient_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -1084,13 +1046,12 @@ rtspclient_suite (void)
|
||||||
tcase_add_test (tc, test_client_multicast_transport_404);
|
tcase_add_test (tc, test_client_multicast_transport_404);
|
||||||
tcase_add_test (tc, test_client_multicast_transport);
|
tcase_add_test (tc, test_client_multicast_transport);
|
||||||
tcase_add_test (tc, test_client_multicast_ignore_transport_specific);
|
tcase_add_test (tc, test_client_multicast_ignore_transport_specific);
|
||||||
|
tcase_add_test (tc, test_client_multicast_invalid_transport_specific);
|
||||||
tcase_add_test (tc, test_client_multicast_transport_specific);
|
tcase_add_test (tc, test_client_multicast_transport_specific);
|
||||||
tcase_add_test (tc, test_client_sdp_with_max_bitrate_tag);
|
tcase_add_test (tc, test_client_sdp_with_max_bitrate_tag);
|
||||||
tcase_add_test (tc, test_client_sdp_with_bitrate_tag);
|
tcase_add_test (tc, test_client_sdp_with_bitrate_tag);
|
||||||
tcase_add_test (tc, test_client_sdp_with_max_bitrate_and_bitrate_tags);
|
tcase_add_test (tc, test_client_sdp_with_max_bitrate_and_bitrate_tags);
|
||||||
tcase_add_test (tc, test_client_sdp_with_no_bitrate_tags);
|
tcase_add_test (tc, test_client_sdp_with_no_bitrate_tags);
|
||||||
tcase_add_test (tc,
|
|
||||||
test_client_multicast_transport_specific_two_clients_shared_media);
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,63 +314,6 @@ GST_START_TEST (test_reset)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_mcast_ttl)
|
|
||||||
{
|
|
||||||
GstRTSPMediaFactory *factory;
|
|
||||||
GstElement *element;
|
|
||||||
GstRTSPMedia *media;
|
|
||||||
GstRTSPUrl *url;
|
|
||||||
GstRTSPStream *stream;
|
|
||||||
|
|
||||||
factory = gst_rtsp_media_factory_new ();
|
|
||||||
gst_rtsp_media_factory_set_shared (factory, TRUE);
|
|
||||||
fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test",
|
|
||||||
&url) == GST_RTSP_OK);
|
|
||||||
|
|
||||||
gst_rtsp_media_factory_set_launch (factory,
|
|
||||||
"( videotestsrc ! rtpvrawpay pt=96 name=pay0 "
|
|
||||||
" audiotestsrc ! audioconvert ! rtpL16pay name=pay1 )");
|
|
||||||
|
|
||||||
/* try to set an invalid ttl and make sure that the default ttl value (255) is
|
|
||||||
* set */
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (factory, 0);
|
|
||||||
fail_unless (gst_rtsp_media_factory_get_max_mcast_ttl (factory) == 255);
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (factory, 300);
|
|
||||||
fail_unless (gst_rtsp_media_factory_get_max_mcast_ttl (factory) == 255);
|
|
||||||
|
|
||||||
/* set a valid ttl value */
|
|
||||||
gst_rtsp_media_factory_set_max_mcast_ttl (factory, 3);
|
|
||||||
fail_unless (gst_rtsp_media_factory_get_max_mcast_ttl (factory) == 3);
|
|
||||||
|
|
||||||
element = gst_rtsp_media_factory_create_element (factory, url);
|
|
||||||
fail_unless (GST_IS_BIN (element));
|
|
||||||
fail_if (GST_IS_PIPELINE (element));
|
|
||||||
gst_object_unref (element);
|
|
||||||
|
|
||||||
media = gst_rtsp_media_factory_construct (factory, url);
|
|
||||||
fail_unless (GST_IS_RTSP_MEDIA (media));
|
|
||||||
|
|
||||||
fail_unless (gst_rtsp_media_n_streams (media) == 2);
|
|
||||||
fail_unless (gst_rtsp_media_get_max_mcast_ttl (media) == 3);
|
|
||||||
|
|
||||||
/* verify that the correct ttl value has been propageted to the media
|
|
||||||
* streams */
|
|
||||||
stream = gst_rtsp_media_get_stream (media, 0);
|
|
||||||
fail_unless (stream != NULL);
|
|
||||||
fail_unless (gst_rtsp_stream_get_max_mcast_ttl (stream) == 3);
|
|
||||||
|
|
||||||
stream = gst_rtsp_media_get_stream (media, 1);
|
|
||||||
fail_unless (stream != NULL);
|
|
||||||
fail_unless (gst_rtsp_stream_get_max_mcast_ttl (stream) == 3);
|
|
||||||
|
|
||||||
g_object_unref (media);
|
|
||||||
|
|
||||||
gst_rtsp_url_free (url);
|
|
||||||
g_object_unref (factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
rtspmediafactory_suite (void)
|
rtspmediafactory_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +329,6 @@ rtspmediafactory_suite (void)
|
||||||
tcase_add_test (tc, test_addresspool);
|
tcase_add_test (tc, test_addresspool);
|
||||||
tcase_add_test (tc, test_permissions);
|
tcase_add_test (tc, test_permissions);
|
||||||
tcase_add_test (tc, test_reset);
|
tcase_add_test (tc, test_reset);
|
||||||
tcase_add_test (tc, test_mcast_ttl);
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue