From: Pierre Ynard Date: Fri, 22 Jan 2010 17:47:09 +0000 (+0100) Subject: rtp sout: fix RTSP track numbering in SDP X-Git-Tag: 1.1.0-ff~1051 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e30cb4fb539e4fa5ae16ae04c45fe9c6ed52f586;p=vlc rtp sout: fix RTSP track numbering in SDP Add a helper to get the right values from the RTSP code --- diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index e20669e40a..c9568c8837 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -833,11 +833,12 @@ char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url ) if( rtsp_url != NULL ) { - assert( strlen( rtsp_url ) > 0 ); - bool addslash = ( rtsp_url[strlen( rtsp_url ) - 1] != '/' ); - sdp_AddAttribute ( &psz_sdp, "control", - addslash ? "%s/trackID=%u" : "%strackID=%u", - rtsp_url, i ); + char *track_url = RtspAppendTrackPath( id->rtsp_id, rtsp_url ); + if( track_url != NULL ) + { + sdp_AddAttribute ( &psz_sdp, "control", "%s", track_url ); + free( track_url ); + } } else { diff --git a/modules/stream_out/rtp.h b/modules/stream_out/rtp.h index d4bc7414e8..94b8a79960 100644 --- a/modules/stream_out/rtp.h +++ b/modules/stream_out/rtp.h @@ -34,6 +34,8 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid, unsigned loport, unsigned hiport ); void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * ); +char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base ); + char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url ); uint32_t rtp_compute_ts( const sout_stream_id_t *id, int64_t i_pts ); diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c index 844890ed05..1bc02bc6c3 100644 --- a/modules/stream_out/rtsp.c +++ b/modules/stream_out/rtsp.c @@ -179,6 +179,19 @@ struct rtsp_strack_t }; +char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base ) +{ + assert( ( strlen( base ) > 0 && base[strlen( base ) - 1] == '/' ) + ^ ( id->stream->track_sep[0] == '/' ) ); + + char *url; + if( asprintf( &url, "%s%strackID=%u", base, id->stream->track_sep, + id->track_id ) == -1 ) + url = NULL; + return url; +} + + rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid, uint32_t ssrc, /* Multicast stuff - TODO: cleanup */