From: Wim Taymans Date: Mon, 27 Jul 2009 17:42:44 +0000 (+0200) Subject: rtsp: allocate channels in TCP mode X-Git-Tag: 1.19.3~495^2~1511 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7338ab81e1ffb5ddf600fa15ff06bc8a7736057b;p=platform%2Fupstream%2Fgstreamer.git rtsp: allocate channels in TCP mode When the client does not provide us with channels in TCP mode, allocate channels ourselves. --- diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 65217b9..c2986d4 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -797,6 +797,14 @@ handle_setup_request (GstRTSPClient * client, GstRTSPUrl * uri, if (media == NULL) goto not_found; + /* fix the transports */ + if (ct->lower_transport & GST_RTSP_LOWER_TRANS_TCP) { + /* check if the client selected channels for TCP */ + if (ct->interleaved.min == -1 || ct->interleaved.max == -1) { + gst_rtsp_session_media_alloc_channels (media, &ct->interleaved); + } + } + /* get a handle to the stream in the media */ if (!(stream = gst_rtsp_session_media_get_stream (media, streamid))) goto no_stream; @@ -1307,9 +1315,11 @@ message_received (GstRTSPWatch * watch, GstRTSPMessage * message, static GstRTSPResult message_sent (GstRTSPWatch * watch, guint cseq, gpointer user_data) { - GstRTSPClient *client = GST_RTSP_CLIENT (user_data); + GstRTSPClient *client; + + client = GST_RTSP_CLIENT (user_data); - g_message ("client %p: sent a message with cseq %d", client, cseq); + /* g_message ("client %p: sent a message with cseq %d", client, cseq); */ return GST_RTSP_OK; } diff --git a/gst/rtsp-server/rtsp-session.c b/gst/rtsp-server/rtsp-session.c index 3afd788..7525036 100644 --- a/gst/rtsp-server/rtsp-session.c +++ b/gst/rtsp-server/rtsp-session.c @@ -323,6 +323,15 @@ no_media: } } +gboolean +gst_rtsp_session_media_alloc_channels (GstRTSPSessionMedia *media, GstRTSPRange *range) +{ + range->min = media->counter++; + range->max = media->counter++; + + return TRUE; +} + /** * gst_rtsp_session_new: * @@ -481,8 +490,7 @@ gst_rtsp_session_stream_set_transport (GstRTSPSessionStream *stream, st->lower_transport = ct->lower_transport; st->client_port = ct->client_port; st->interleaved = ct->interleaved; - st->server_port.min = stream->media_stream->server_port.min; - st->server_port.max = stream->media_stream->server_port.max; + st->server_port = stream->media_stream->server_port; /* keep track of the transports in the stream. */ if (stream->trans.transport) diff --git a/gst/rtsp-server/rtsp-session.h b/gst/rtsp-server/rtsp-session.h index 0074b55..5681667 100644 --- a/gst/rtsp-server/rtsp-session.h +++ b/gst/rtsp-server/rtsp-session.h @@ -75,6 +75,9 @@ struct _GstRTSPSessionMedia /* the server state */ GstRTSPState state; + /* counter for channels */ + guint counter; + /* configuration for the different streams */ GArray *streams; }; @@ -138,6 +141,9 @@ gboolean gst_rtsp_session_media_set_state (GstRTSPSessionMedi GstRTSPSessionStream * gst_rtsp_session_media_get_stream (GstRTSPSessionMedia *media, guint idx); +gboolean gst_rtsp_session_media_alloc_channels (GstRTSPSessionMedia *media, + GstRTSPRange *range); + /* configure transport */ GstRTSPTransport * gst_rtsp_session_stream_set_transport (GstRTSPSessionStream *stream, GstRTSPTransport *ct);