client: store setup uri and use in PLAY response
authorWim Taymans <wtaymans@redhat.com>
Thu, 28 Nov 2013 16:47:18 +0000 (17:47 +0100)
committerWim Taymans <wtaymans@redhat.com>
Thu, 28 Nov 2013 16:47:18 +0000 (17:47 +0100)
Store the uri used when doing the setup and use that in the PLAY
response.

fixes https://bugzilla.gnome.org/show_bug.cgi?id=715168

gst/rtsp-server/rtsp-client.c

index 162f52c..a9ccbc2 100644 (file)
@@ -1041,7 +1041,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
   GstRTSPUrl *uri;
   GString *rtpinfo;
   guint n_streams, i, infocount;
-  gchar *str, *base_url;
+  gchar *str;
   GstRTSPTimeRange *range;
   GstRTSPResult res;
   GstRTSPState rtspstate;
@@ -1092,8 +1092,6 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
   /* grab RTPInfo from the payloaders now */
   rtpinfo = g_string_new ("");
 
-  base_url = make_base_url (client, uri, path);
-
   n_streams = gst_rtsp_media_n_streams (media);
   for (i = 0, infocount = 0; i < n_streams; i++) {
     GstRTSPStreamTransport *trans;
@@ -1116,22 +1114,23 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
 
     stream = gst_rtsp_stream_transport_get_stream (trans);
     if (gst_rtsp_stream_get_rtpinfo (stream, &rtptime, &seq)) {
-      gchar *control;
+      const GstRTSPUrl *url;
+      gchar *url_str;
 
       if (infocount > 0)
         g_string_append (rtpinfo, ", ");
 
-      control = gst_rtsp_stream_get_control (stream);
-      g_string_append_printf (rtpinfo, "url=%s%s;seq=%u;rtptime=%u",
-          base_url, control, seq, rtptime);
-      g_free (control);
+      url = gst_rtsp_stream_transport_get_url (trans);
+      url_str = gst_rtsp_url_get_request_uri (url);
+      g_string_append_printf (rtpinfo, "url=%s;seq=%u;rtptime=%u",
+          url_str, seq, rtptime);
+      g_free (url_str);
 
       infocount++;
     } else {
       GST_WARNING ("RTP-Info cannot be determined for stream %d", i);
     }
   }
-  g_free (base_url);
   g_free (path);
 
   /* construct the response now */
@@ -1477,7 +1476,7 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
   if (path[matched] == '\0')
     goto control_not_found;
 
-  /* path is what matched. We can modify the parsed uri in place */
+  /* path is what matched. */
   path[matched] = '\0';
   /* control is remainder */
   control = &path[matched + 1];
@@ -1539,6 +1538,10 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
   /* set in the session media transport */
   trans = gst_rtsp_session_media_set_transport (sessmedia, stream, ct);
 
+  /* configure the url used to set this transport, this we will use when
+   * generating the response for the PLAY request */
+  gst_rtsp_stream_transport_set_url (trans, uri);
+
   /* configure keepalive for this transport */
   gst_rtsp_stream_transport_set_keepalive (trans,
       (GstRTSPKeepAliveFunc) do_keepalive, session, NULL);