From: Sebastian Dröge Date: Mon, 19 Jan 2015 12:09:20 +0000 (+0100) Subject: rtsp-client: If we have a single-stream media and SETUP contains no control, use... X-Git-Tag: 1.6.0~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fcef562f35f8377346888629a7b4a73df4be4ff8;p=platform%2Fupstream%2Fgst-rtsp-server.git rtsp-client: If we have a single-stream media and SETUP contains no control, use the one and only stream --- 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;