}
g_strfreev (transports);
- g_free (ct->destination);
- ct->destination = g_strdup (inet_ntoa (client->address.sin_addr));
-
/* we have not found anything usable, error out */
- if (!have_transport) {
+ if (!have_transport)
goto unsupported_transports;
- }
/* we have a valid transport, check if we can handle it */
if (ct->trans != GST_RTSP_TRANS_RTP)
goto unsupported_transports;
if (ct->profile != GST_RTSP_PROFILE_AVP)
goto unsupported_transports;
+
supported = GST_RTSP_LOWER_TRANS_UDP |
GST_RTSP_LOWER_TRANS_UDP_MCAST | GST_RTSP_LOWER_TRANS_TCP;
if (!(ct->lower_transport & supported))
if (client->session_pool == NULL)
goto no_pool;
+ /* we have a valid transport now, set the destination of the client. */
+ g_free (ct->destination);
+ ct->destination = g_strdup (inet_ntoa (client->address.sin_addr));
+
/* a setup request creates a session for a client, check if the client already
* sent a session id to us */
res = gst_rtsp_message_get_header (request, GST_RTSP_HDR_SESSION, &sessid, 0);
/* get a handle to the configuration of the media in the session */
if ((m = find_media (client, uri, request))) {
+ /* manage the media in our session now */
media = gst_rtsp_session_manage_media (session, uri, m);
}
}
gst_rtsp_media_init (GstRTSPMedia * media)
{
media->streams = g_array_new (FALSE, TRUE, sizeof (GstRTSPMediaStream *));
+ media->complete = FALSE;
}
static void
gst_rtsp_media_stream_free (GstRTSPMediaStream *stream)
{
+ if (stream->caps)
+ gst_caps_unref (stream->caps);
+
+ g_free (stream);
}
static void
}
g_array_free (media->streams, TRUE);
+ gst_object_unref (media->pipeline);
+
G_OBJECT_CLASS (gst_rtsp_media_parent_class)->finalize (obj);
}
*
* Retrieve the stream with index @idx from @media.
*
- * Returns: the #GstRTSPMediaStream at index @idx.
+ * Returns: the #GstRTSPMediaStream at index @idx or %NULL when a stream with
+ * that index did not exist.
*/
GstRTSPMediaStream *
gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx)
GstRTSPMediaStream *res;
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), NULL);
- g_return_val_if_fail (idx < media->streams->len, NULL);
- res = g_array_index (media->streams, GstRTSPMediaStream *, idx);
+ if (idx < media->streams->len)
+ res = g_array_index (media->streams, GstRTSPMediaStream *, idx);
+ else
+ res = NULL;
return res;
}
/* we keep these elements, we configure all in configure_transport when the
* server told us to really use the UDP ports. */
- stream->udpsrc[0] = gst_object_ref (udpsrc0);
- stream->udpsrc[1] = gst_object_ref (udpsrc1);
- stream->udpsink[0] = gst_object_ref (udpsink0);
- stream->udpsink[1] = gst_object_ref (udpsink1);
+ stream->udpsrc[0] = udpsrc0;
+ stream->udpsrc[1] = udpsrc1;
+ stream->udpsink[0] = udpsink0;
+ stream->udpsink[1] = udpsink1;
stream->server_port.min = rtpport;
stream->server_port.max = rtcpport;
- /* they are ours now */
- gst_object_sink (udpsrc0);
- gst_object_sink (udpsrc1);
- gst_object_sink (udpsink0);
- gst_object_sink (udpsink1);
-
return TRUE;
/* ERRORS */
/* and back to PAUSED for live pipelines */
ret = gst_element_set_state (media->pipeline, GST_STATE_PAUSED);
+ /* unlock the udp src elements */
n_streams = gst_rtsp_media_n_streams (media);
for (i = 0; i < n_streams; i++) {
GstRTSPMediaStream *stream;