]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtp.c
rtp sout: fix RTSP track numbering in SDP
[vlc] / modules / stream_out / rtp.c
index d78a12d9a3292c0f421d6ebea1513fe2808d043c..c9568c88376d8fbb03ca0f7b12bf06a0cb66f4e2 100644 (file)
@@ -457,10 +457,10 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->i_ttl == -1 )
     {
         /* Normally, we should let the default hop limit up to the core,
-         * but we have to know it to build our SDP properly, which is why
-         * we ask the core. FIXME: broken when neither sout-rtp-ttl nor
-         * ttl are set. */
-        p_sys->i_ttl = config_GetInt( p_stream, "ttl" );
+         * but we have to know it to write our RTSP headers properly,
+         * which is why we ask the core. FIXME: broken when neither
+         * sout-rtp-ttl nor ttl are set. */
+        p_sys->i_ttl = var_InheritInteger( p_stream, "ttl" );
     }
 
     p_sys->b_latm = var_GetBool( p_stream, SOUT_CFG_PREFIX "mp4a-latm" );
@@ -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
         {
@@ -977,7 +978,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         id->i_bitrate = 0;
     }
 
-    id->i_mtu = config_GetInt( p_stream, "mtu" );
+    id->i_mtu = var_InheritInteger( p_stream, "mtu" );
     if( id->i_mtu <= 12 + 16 )
         id->i_mtu = 576 - 20 - 8; /* pessimistic */
     msg_Dbg( p_stream, "maximum RTP packet size: %d bytes", id->i_mtu );