]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtsp.c
video_output/xcb: add --xvideo-format-id config option
[vlc] / modules / stream_out / rtsp.c
index f70abe34c48404716cfa89d89213b1cf9f6b5537..a1cc95317051da7d790541f7943e66f8f86d9a59 100644 (file)
@@ -122,12 +122,12 @@ error:
 
 void RtspUnsetup( rtsp_stream_t *rtsp )
 {
-    while( rtsp->sessionc > 0 )
-        RtspClientDel( rtsp, rtsp->sessionv[0] );
-
     if( rtsp->url )
         httpd_UrlDelete( rtsp->url );
 
+    while( rtsp->sessionc > 0 )
+        RtspClientDel( rtsp, rtsp->sessionv[0] );
+
     if( rtsp->host )
         httpd_HostDelete( rtsp->host );
 
@@ -244,6 +244,8 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
 
 void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t *id )
 {
+    httpd_UrlDelete( id->url );
+
     vlc_mutex_lock( &rtsp->lock );
     for( int i = 0; i < rtsp->sessionc; i++ )
     {
@@ -254,14 +256,13 @@ void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t *id )
             if( ses->trackv[j].id == id )
             {
                 rtsp_strack_t *tr = ses->trackv + j;
-                net_Close( tr->fd );
+                rtp_del_sink( tr->id->sout_id, tr->fd );
                 REMOVE_ELEM( ses->trackv, ses->trackc, j );
             }
         }
     }
 
     vlc_mutex_unlock( &rtsp->lock );
-    httpd_UrlDelete( id->url );
     free( id );
 }
 
@@ -397,7 +398,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
     answer->i_body = 0;
     answer->p_body = NULL;
 
-    httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
+    httpd_MsgAdd( answer, "Server", "VLC/%s", VERSION );
 
     /* Date: is always allowed, and sometimes mandatory with RTSP/2.0. */
     struct tm ut;
@@ -537,8 +538,8 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                     if( psz_session == NULL )
                     {
                         /* Create a dummy session ID */
-                        snprintf( psz_sesbuf, sizeof( psz_sesbuf ), "%d",
-                                  rand() );
+                        snprintf( psz_sesbuf, sizeof( psz_sesbuf ), "%lu",
+                                  vlc_mrand48() );
                         psz_session = psz_sesbuf;
                     }
                     answer->i_status = 200;