rtsp: allocate channels in TCP mode

When the client does not provide us with channels in TCP mode, allocate channels
ourselves.
This commit is contained in:
Wim Taymans 2009-07-27 19:42:44 +02:00
parent daccf6bc99
commit 7338ab81e1
3 changed files with 28 additions and 4 deletions

View file

@ -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;
}

View file

@ -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)

View file

@ -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);