Commit e30cb4fb authored by Pierre Ynard's avatar Pierre Ynard

rtp sout: fix RTSP track numbering in SDP

Add a helper to get the right values from the RTSP code
parent 94558b79
......@@ -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
{
......
......@@ -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 );
......
......@@ -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 */
......
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