Commit 94558b79 authored by Pierre Ynard's avatar Pierre Ynard

rtp sout: fix duplicate slashes in RTSP URLs

parent 5cd12c79
...@@ -52,7 +52,7 @@ struct rtsp_stream_t ...@@ -52,7 +52,7 @@ struct rtsp_stream_t
httpd_host_t *host; httpd_host_t *host;
httpd_url_t *url; httpd_url_t *url;
char *psz_path; char *psz_path;
const char *track_fmt; const char *track_sep;
unsigned track_id; unsigned track_id;
unsigned port; unsigned port;
...@@ -94,10 +94,8 @@ rtsp_stream_t *RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url ) ...@@ -94,10 +94,8 @@ rtsp_stream_t *RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url )
goto error; goto error;
assert( strlen( rtsp->psz_path ) > 0 ); assert( strlen( rtsp->psz_path ) > 0 );
if( rtsp->psz_path[strlen( rtsp->psz_path ) - 1] == '/' ) rtsp->track_sep = rtsp->psz_path[strlen( rtsp->psz_path ) - 1] == '/' ?
rtsp->track_fmt = "%strackID=%u"; "" : "/";
else
rtsp->track_fmt = "%s/trackID=%u";
msg_Dbg( p_stream, "RTSP stream: host %s port %d at %s", msg_Dbg( p_stream, "RTSP stream: host %s port %d at %s",
url->psz_host, rtsp->port, rtsp->psz_path ); url->psz_host, rtsp->port, rtsp->psz_path );
...@@ -207,8 +205,8 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid, ...@@ -207,8 +205,8 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
id->hiport = hiport; id->hiport = hiport;
} }
snprintf( urlbuf, sizeof( urlbuf ), rtsp->track_fmt, rtsp->psz_path, snprintf( urlbuf, sizeof( urlbuf ), "%s%strackID=%u", rtsp->psz_path,
id->track_id ); rtsp->track_sep, id->track_id );
msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf ); msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf );
url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, NULL, NULL, NULL ); url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, NULL, NULL, NULL );
...@@ -663,8 +661,9 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id, ...@@ -663,8 +661,9 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
else else
seq = rtp_get_seq( tr->id->sout_id ); seq = rtp_get_seq( tr->id->sout_id );
infolen += sprintf( info + infolen, infolen += sprintf( info + infolen,
"url=%s/trackID=%u;seq=%u;rtptime=%u, ", "url=%s%strackID=%u;seq=%u;rtptime=%u, ",
control, tr->id->track_id, seq, control, rtsp->track_sep,
tr->id->track_id, seq,
rtp_compute_ts( tr->id->sout_id, ts ) ); rtp_compute_ts( tr->id->sout_id, ts ) );
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment