From fcef562f35f8377346888629a7b4a73df4be4ff8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 19 Jan 2015 13:09:20 +0100 Subject: [PATCH] rtsp-client: If we have a single-stream media and SETUP contains no control, use the one and only stream --- gst/rtsp-server/rtsp-client.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 6fbb5ea..54d1d50 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -1726,7 +1726,7 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) GstRTSPStream *stream; GstRTSPState rtspstate; GstRTSPClientClass *klass; - gchar *path, *control; + gchar *path, *control = NULL; gint matched; gboolean new_session = FALSE; @@ -1775,16 +1775,22 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx) if (media == NULL) goto media_not_found_no_reply; - if (path[matched] == '\0') - goto control_not_found; + if (path[matched] == '\0') { + if (gst_rtsp_media_n_streams (media) == 1) { + stream = gst_rtsp_media_get_stream (media, 0); + } else { + goto control_not_found; + } + } else { + /* path is what matched. */ + path[matched] = '\0'; + /* control is remainder */ + control = &path[matched + 1]; - /* path is what matched. */ - path[matched] = '\0'; - /* control is remainder */ - control = &path[matched + 1]; + /* find the stream now using the control part */ + stream = gst_rtsp_media_find_stream (media, control); + } - /* find the stream now using the control part */ - stream = gst_rtsp_media_find_stream (media, control); if (stream == NULL) goto stream_not_found; @@ -1945,7 +1951,8 @@ control_not_found: } stream_not_found: { - GST_ERROR ("client %p: stream '%s' not found", client, control); + GST_ERROR ("client %p: stream '%s' not found", client, + GST_STR_NULL (control)); send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx); g_object_unref (media); goto cleanup_path; -- 2.7.4