diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/Makefile.am /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/Makefile.am
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/Makefile.am	2011-08-05 07:48:26.742988486 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/Makefile.am	2011-08-04 10:43:09.475072372 -0400
@@ -40,7 +40,7 @@
     -lgstrtp-@GST_MAJORMINOR@ -lgstrtsp-@GST_MAJORMINOR@ \
             -lgstsdp-@GST_MAJORMINOR@ \
             -lgstapp-@GST_MAJORMINOR@ \
-	    $(GST_LIBS) $(LIBM)
+	    $(GST_LIBS) $(LIBM) -lgio-2.0
 libgstrtspserver_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static
 
 libgstrtspserver_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/rtsp-server
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/Makefile.in /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/Makefile.in
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/Makefile.in	2011-08-05 09:50:28.757982569 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/Makefile.in	2011-08-03 17:36:53.911373474 -0400
@@ -427,6 +427,7 @@
     -lgstrtp-@GST_MAJORMINOR@ -lgstrtsp-@GST_MAJORMINOR@ \
             -lgstsdp-@GST_MAJORMINOR@ \
             -lgstapp-@GST_MAJORMINOR@ \
+	    -lgio-2.0 \
 	    $(GST_LIBS) $(LIBM)
 
 libgstrtspserver_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-client.c /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-client.c
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-client.c	2011-08-05 07:48:26.742988486 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-client.c	2011-08-08 10:54:35.719980052 -0400
@@ -121,8 +121,10 @@
 
   /* unlink all media managed in this session */
   for (medias = session->medias; medias; medias = g_list_next (medias)) {
-    unlink_session_streams (client, session,
-        (GstRTSPSessionMedia *) medias->data);
+    gst_rtsp_session_media_set_state ((GstRTSPSessionMedia *) medias->data, GST_STATE_NULL);
+    unlink_session_streams (client, session, (GstRTSPSessionMedia *) medias->data);
+    /* unmanage the media in the session. */
+    gst_rtsp_session_release_media (session, (GstRTSPSessionMedia *) medias->data);
   }
 }
 
@@ -854,6 +856,7 @@
   guint streamid;
   GstRTSPSessionMedia *media;
   GstRTSPUrl *url;
+  GstRTSPMedia *m;
 
   uri = state->uri;
 
@@ -928,15 +931,6 @@
   if (client->session_pool == NULL)
     goto no_pool;
 
-  /* we have a valid transport now, set the destination of the client. */
-  g_free (ct->destination);
-  if (ct->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) {
-    ct->destination = g_strdup (MCAST_ADDRESS);
-  } else {
-    url = gst_rtsp_connection_get_url (client->connection);
-    ct->destination = g_strdup (url->host);
-  }
-
   session = state->session;
 
   if (session) {
@@ -958,8 +952,6 @@
 
   /* we have no media, find one and manage it */
   if (media == NULL) {
-    GstRTSPMedia *m;
-
     /* get a handle to the configuration of the media in the session */
     if ((m = find_media (client, state))) {
       /* manage the media in our session now */
@@ -973,6 +965,17 @@
 
   state->sessmedia = media;
 
+  /* we have a valid transport now, set the destination of the client. */
+  g_free (ct->destination);
+  if (ct->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) {
+      if (!(ct->destination = gst_rtsp_media_get_mcast_address(m))) {
+          ct->destination = g_strdup (MCAST_ADDRESS);
+      }
+  } else {
+    url = gst_rtsp_connection_get_url (client->connection);
+    ct->destination = g_strdup (url->host);
+  }
+
   /* fix the transports */
   if (ct->lower_transport & GST_RTSP_LOWER_TRANS_TCP) {
     /* check if the client selected channels for TCP */
@@ -1092,19 +1095,29 @@
 
   info.server_proto = proto;
   if (media->protocols & GST_RTSP_LOWER_TRANS_UDP_MCAST)
-    info.server_ip = MCAST_ADDRESS;
+  {
+    if (!(info.server_ip = gst_rtsp_media_get_mcast_address(media)))
+    {
+        info.server_ip = g_strdup (MCAST_ADDRESS);
+    }
+  }
   else
-    info.server_ip = client->server_ip;
+  {
+    info.server_ip = g_strdup(client->server_ip);
+  }
 
   /* create an SDP for the media object */
   if (!gst_rtsp_sdp_from_media (sdp, &info, media))
     goto no_sdp;
 
+  g_free(info.server_ip);
+
   return sdp;
 
   /* ERRORS */
 no_sdp:
   {
+    g_free(info.server_ip);
     gst_sdp_message_free (sdp);
     return NULL;
   }
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media.c /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media.c
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media.c	2011-08-05 07:48:26.743987036 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media.c	2011-08-04 15:54:18.818054482 -0400
@@ -22,6 +22,7 @@
 
 #include <gst/app/gstappsrc.h>
 #include <gst/app/gstappsink.h>
+#include <gio/gio.h>
 
 #include "rtsp-funnel.h"
 #include "rtsp-media.h"
@@ -32,6 +33,7 @@
 //#define DEFAULT_PROTOCOLS      GST_RTSP_LOWER_TRANS_UDP_MCAST
 #define DEFAULT_EOS_SHUTDOWN   FALSE
 #define DEFAULT_BUFFER_SIZE    0x80000
+#define DEFAULT_MCAST_ADDRESS  NULL
 
 /* define to dump received RTCP packets */
 #undef DUMP_STATS
@@ -44,6 +46,7 @@
   PROP_PROTOCOLS,
   PROP_EOS_SHUTDOWN,
   PROP_BUFFER_SIZE,
+  PROP_MCAST_ADDRESS,
   PROP_LAST
 };
 
@@ -113,6 +116,11 @@
           "The kernel UDP buffer size to use", 0, G_MAXUINT,
           DEFAULT_BUFFER_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  g_object_class_install_property (gobject_class, PROP_MCAST_ADDRESS,
+      g_param_spec_string ("mcast-address", "Multicast Address",
+          "Multicast Address on which to source media",
+          DEFAULT_MCAST_ADDRESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   gst_rtsp_media_signals[SIGNAL_PREPARED] =
       g_signal_new ("prepared", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
       G_STRUCT_OFFSET (GstRTSPMediaClass, prepared), NULL, NULL,
@@ -158,6 +166,7 @@
   media->protocols = DEFAULT_PROTOCOLS;
   media->eos_shutdown = DEFAULT_EOS_SHUTDOWN;
   media->buffer_size = DEFAULT_BUFFER_SIZE;
+  media->mcast_address = DEFAULT_MCAST_ADDRESS;
 }
 
 void
@@ -232,6 +241,7 @@
   }
   g_mutex_free (media->lock);
   g_cond_free (media->cond);
+  g_free (media->mcast_address);
 
   G_OBJECT_CLASS (gst_rtsp_media_parent_class)->finalize (obj);
 }
@@ -258,6 +268,9 @@
     case PROP_BUFFER_SIZE:
       g_value_set_uint (value, gst_rtsp_media_get_buffer_size (media));
       break;
+    case PROP_MCAST_ADDRESS:
+      g_value_set_string (value, gst_rtsp_media_get_mcast_address (media));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
   }
@@ -285,6 +298,9 @@
     case PROP_BUFFER_SIZE:
       gst_rtsp_media_set_buffer_size (media, g_value_get_uint (value));
       break;
+    case PROP_MCAST_ADDRESS:
+      gst_rtsp_media_set_mcast_address (media, (gchar*)g_value_get_string(value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
   }
@@ -529,6 +545,56 @@
 }
 
 /**
+ * gst_rtsp_media_set_mcast_address:
+ * @media: a #GstRTSPMedia
+ *
+ * Set the multicast address
+ *
+ * Returns: TRUE/FALSE.
+ */
+gboolean
+gst_rtsp_media_set_mcast_address  (GstRTSPMedia *media, gchar *mcast_address)
+{
+  GInetAddress *inet_address = NULL;
+  gboolean result = FALSE;
+
+  g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
+  g_return_val_if_fail (mcast_address != NULL, FALSE);
+  g_return_val_if_fail (g_hostname_is_ip_address(mcast_address), FALSE);
+
+  inet_address = g_inet_address_new_from_string (mcast_address);
+
+  g_return_val_if_fail (inet_address != NULL, FALSE);
+
+  if (g_inet_address_get_is_multicast (inet_address)) {
+    g_free (media->mcast_address);
+    media->mcast_address = g_strdup (mcast_address);
+    g_return_val_if_fail (media->mcast_address != NULL, FALSE);
+    result = TRUE;
+  }
+
+  g_object_unref(inet_address);
+
+  return result;
+}
+
+/**
+ * gst_rtsp_media_get_mcast_address:
+ * @media: a #GstRTSPMedia
+ *
+ * Get the multicast address.
+ *
+ * Returns: pointer to the multicast address.
+ */
+gchar*
+gst_rtsp_media_get_mcast_address  (GstRTSPMedia *media)
+{
+  g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), NULL);
+
+  return (g_strdup(media->mcast_address));
+}
+
+/**
  * gst_rtsp_media_set_auth:
  * @media: a #GstRTSPMedia
  * @auth: a #GstRTSPAuth
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media-factory.c /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media-factory.c
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media-factory.c	2011-08-05 07:48:26.743987036 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media-factory.c	2011-08-05 08:53:22.000980696 -0400
@@ -18,11 +18,13 @@
  */
 
 #include "rtsp-media-factory.h"
+#include <gio/gio.h>
 
 #define DEFAULT_LAUNCH         NULL
 #define DEFAULT_SHARED         FALSE
 #define DEFAULT_EOS_SHUTDOWN   FALSE
 #define DEFAULT_BUFFER_SIZE    0x80000
+#define DEFAULT_MCAST_ADDRESS  NULL
 
 enum
 {
@@ -31,6 +33,7 @@
   PROP_SHARED,
   PROP_EOS_SHUTDOWN,
   PROP_BUFFER_SIZE,
+  PROP_MCAST_ADDRESS,
   PROP_LAST
 };
 
@@ -138,6 +141,7 @@
   g_mutex_free (factory->lock);
   if (factory->auth)
     g_object_unref (factory->auth);
+  g_free (factory->mcast_address);
 
   G_OBJECT_CLASS (gst_rtsp_media_factory_parent_class)->finalize (obj);
 }
@@ -163,6 +167,9 @@
       g_value_set_uint (value,
           gst_rtsp_media_factory_get_buffer_size (factory));
       break;
+    case PROP_MCAST_ADDRESS:
+      g_value_set_string (value, gst_rtsp_media_factory_get_mcast_address (factory));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
   }
@@ -189,6 +196,9 @@
       gst_rtsp_media_factory_set_buffer_size (factory,
           g_value_get_uint (value));
       break;
+    case PROP_MCAST_ADDRESS:
+      gst_rtsp_media_factory_set_mcast_address (factory, (gchar*)g_value_get_string(value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
   }
@@ -386,6 +396,56 @@
 }
 
 /**
+ * gst_rtsp_media_factory_set_mcast_address:
+ * @factory: a #GstRTSPMediaFactory
+ *
+ * Set the multicast address
+ *
+ * Returns: TRUE/FALSE.
+ */
+gboolean
+gst_rtsp_media_factory_set_mcast_address  (GstRTSPMediaFactory *factory, gchar *mcast_address)
+{
+  GInetAddress *inet_address = NULL;
+  gboolean result = FALSE;
+
+  g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), FALSE);
+  g_return_val_if_fail (mcast_address != NULL, FALSE);
+  g_return_val_if_fail (g_hostname_is_ip_address(mcast_address), FALSE);
+
+  inet_address = g_inet_address_new_from_string (mcast_address);
+
+  g_return_val_if_fail (inet_address != NULL, FALSE);
+
+  if (g_inet_address_get_is_multicast (inet_address)) {
+    g_free (factory->mcast_address);
+    factory->mcast_address = g_strdup (mcast_address);
+    g_return_val_if_fail (factory->mcast_address != NULL, FALSE);
+    result = TRUE;
+  }
+
+  g_object_unref(inet_address);
+
+  return result;
+}
+
+/**
+ * gst_rtsp_media_factory_get_mcast_address:
+ * @factory: a #GstRTSPMediaFactory
+ *
+ * Get the multicast address.
+ *
+ * Returns: pointer to the multicast address.
+ */
+gchar*
+gst_rtsp_media_factory_get_mcast_address  (GstRTSPMediaFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), NULL);
+
+  return (g_strdup(factory->mcast_address));
+}
+
+/**
  * gst_rtsp_media_factory_set_auth:
  * @factory: a #GstRTSPMediaFactory
  * @auth: a #GstRTSPAuth
@@ -717,17 +777,23 @@
   gboolean shared, eos_shutdown;
   guint size;
   GstRTSPAuth *auth;
+  gchar *mcast_address;
 
   /* configure the sharedness */
   GST_RTSP_MEDIA_FACTORY_LOCK (factory);
   shared = factory->shared;
   eos_shutdown = factory->eos_shutdown;
   size = factory->buffer_size;
+  mcast_address = g_strdup(factory->mcast_address);
   GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
 
   gst_rtsp_media_set_shared (media, shared);
   gst_rtsp_media_set_eos_shutdown (media, eos_shutdown);
   gst_rtsp_media_set_buffer_size (media, size);
+  if (mcast_address) {
+      gst_rtsp_media_set_mcast_address (media, mcast_address);
+  }
+  g_free(mcast_address);
 
   if ((auth = gst_rtsp_media_factory_get_auth (factory))) {
     gst_rtsp_media_set_auth (media, auth);
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media-factory.h /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media-factory.h
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media-factory.h	2011-08-05 07:48:26.743987036 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media-factory.h	2011-08-04 14:27:35.381991432 -0400
@@ -65,6 +65,7 @@
   gboolean      eos_shutdown;
   GstRTSPAuth  *auth;
   guint         buffer_size;
+  gchar        *mcast_address;
 
   GMutex       *medias_lock;
   GHashTable   *medias;
@@ -125,6 +126,8 @@
 void                  gst_rtsp_media_factory_set_buffer_size    (GstRTSPMediaFactory * factory, guint size);
 guint                 gst_rtsp_media_factory_get_buffer_size    (GstRTSPMediaFactory * factory);
 
+gboolean              gst_rtsp_media_factory_set_mcast_address  (GstRTSPMediaFactory *factory, gchar *mcast_address);
+gchar*                gst_rtsp_media_factory_get_mcast_address  (GstRTSPMediaFactory *factory);
 
 /* creating the media from the factory and a url */
 GstRTSPMedia *        gst_rtsp_media_factory_construct    (GstRTSPMediaFactory *factory,
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media.h /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media.h
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-media.h	2011-08-05 07:48:26.744987365 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-media.h	2011-08-03 15:33:55.676125755 -0400
@@ -203,6 +203,7 @@
   gboolean           eos_shutdown;
   guint              buffer_size;
   GstRTSPAuth       *auth;
+  gchar             *mcast_address;
 
   GstElement        *element;
   GArray            *streams;
@@ -282,6 +283,9 @@
 void                  gst_rtsp_media_set_buffer_size  (GstRTSPMedia *media, guint size);
 guint                 gst_rtsp_media_get_buffer_size  (GstRTSPMedia *media);
 
+gboolean              gst_rtsp_media_set_mcast_address  (GstRTSPMedia *media, gchar *mcast_address);
+gchar*                gst_rtsp_media_get_mcast_address  (GstRTSPMedia *media);
+
 /* prepare the media for playback */
 gboolean              gst_rtsp_media_prepare          (GstRTSPMedia *media);
 gboolean              gst_rtsp_media_is_prepared      (GstRTSPMedia *media);
diff -Naur /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-sdp.h /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-sdp.h
--- /home/silentm/Development/gst-rtsp-server/gst/rtsp-server/rtsp-sdp.h	2011-08-05 07:48:26.744987365 -0400
+++ /home/silentm/Development/gst-rtsp-server-patched/gst/rtsp-server/rtsp-sdp.h	2011-08-08 10:01:48.368156535 -0400
@@ -29,7 +29,7 @@
 
 typedef struct {
   const gchar *server_proto;
-  const gchar *server_ip;
+  gchar *server_ip;
 } GstSDPInfo;
 
 /* creating SDP */
