From: Wim Taymans Date: Wed, 14 Nov 2012 15:17:33 +0000 (+0100) Subject: address-pool: add clear method X-Git-Tag: 1.19.3~495^2~1286 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0ffc8e67954a73489c1c95f7c8932f5c290dd8b;p=platform%2Fupstream%2Fgstreamer.git address-pool: add clear method --- diff --git a/gst/rtsp-server/rtsp-address-pool.c b/gst/rtsp-server/rtsp-address-pool.c index 957814e..194e290 100644 --- a/gst/rtsp-server/rtsp-address-pool.c +++ b/gst/rtsp-server/rtsp-address-pool.c @@ -120,6 +120,29 @@ gst_rtsp_address_pool_new (void) return pool; } +/** + * gst_rtsp_address_pool_clear: + * @pool: a #GstRTSPAddressPool + * + * Clear all addresses in @pool. There should be no outstanding + * allocations. + */ +void +gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool) +{ + GstRTSPAddressPoolPrivate *priv; + + g_return_if_fail (GST_IS_RTSP_ADDRESS_POOL (pool)); + g_return_if_fail (pool->priv->allocated == NULL); + + priv = pool->priv; + + g_mutex_lock (&priv->lock); + g_list_free_full (priv->addresses, (GDestroyNotify) free_range); + priv->addresses = NULL; + g_mutex_unlock (&priv->lock); +} + static gboolean fill_address (const gchar * address, guint16 port, Addr * addr) { diff --git a/gst/rtsp-server/rtsp-address-pool.h b/gst/rtsp-server/rtsp-address-pool.h index 57a52fc..d29e1e0 100644 --- a/gst/rtsp-server/rtsp-address-pool.h +++ b/gst/rtsp-server/rtsp-address-pool.h @@ -64,6 +64,7 @@ GType gst_rtsp_address_pool_get_type (void); /* create a new address pool */ GstRTSPAddressPool * gst_rtsp_address_pool_new (void); +void gst_rtsp_address_pool_clear (GstRTSPAddressPool * pool); void gst_rtsp_address_pool_dump (GstRTSPAddressPool * pool); gboolean gst_rtsp_address_pool_add_range (GstRTSPAddressPool * pool,