]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
Fix potential object leak.
[vlc] / modules / demux / live555.cpp
index cb4d27a23def3c25980307538868f6e2b3bf6b0d..414c51fcdaf4cf3dac8e4735d1cbf7c939122bfa 100644 (file)
@@ -103,26 +103,32 @@ vlc_module_begin ()
         set_description( N_("RTSP/RTP access and demux") )
         add_shortcut( "rtsp" )
         add_shortcut( "sdp" )
+        add_shortcut( "live" )
+        add_shortcut( "livedotcom" )
         set_capability( "access_demux", 0 )
         set_callbacks( Open, Close )
         add_bool( "rtsp-tcp", 0, NULL,
                   N_("Use RTP over RTSP (TCP)"),
                   N_("Use RTP over RTSP (TCP)"), true )
+            change_safe()
         add_integer( "rtp-client-port", -1, NULL,
                   N_("Client port"),
                   N_("Port to use for the RTP source of the session"), true )
         add_bool( "rtsp-mcast", false, NULL,
                   N_("Force multicast RTP via RTSP"),
                   N_("Force multicast RTP via RTSP"), true )
+            change_safe()
         add_bool( "rtsp-http", 0, NULL,
                   N_("Tunnel RTSP and RTP over HTTP"),
                   N_("Tunnel RTSP and RTP over HTTP"), true )
+            change_safe()
         add_integer( "rtsp-http-port", 80, NULL,
                   N_("HTTP tunnel port"),
                   N_("Port to use for tunneling the RTSP/RTP over HTTP."),
                   true )
         add_integer("rtsp-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL,
                     CACHING_TEXT, CACHING_LONGTEXT, true )
+            change_safe()
         add_bool(   "rtsp-kasenna", false, NULL, KASENNA_TEXT,
                     KASENNA_LONGTEXT, true )
         add_string( "rtsp-user", NULL, NULL, USER_TEXT,
@@ -479,7 +485,6 @@ static int Connect( demux_t *p_demux )
     char *p_sdp       = NULL;
     int  i_http_port  = 0;
     int  i_ret        = VLC_SUCCESS;
-    int timeout;
 
     if( p_sys->url.i_port == 0 ) p_sys->url.i_port = 554;
     if( p_sys->url.psz_username || p_sys->url.psz_password )
@@ -542,12 +547,12 @@ describe:
     authenticator.setUsernameAndPassword( (const char*)psz_user,
                                           (const char*)psz_pwd );
 
-    timeout = var_CreateGetInteger(p_demux, "ipv4-timeout");
-    timeout /= 1000;
+    /* */
+    const int i_timeout = var_CreateGetInteger(p_demux, "ipv4-timeout") / 1000;
 
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
-                                               &authenticator, timeout );
+                                               &authenticator, i_timeout );
 #else
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
@@ -557,7 +562,7 @@ describe:
         // try again, with the realm set this time
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
         psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
-                                               &authenticator, timeout );
+                                               &authenticator, i_timeout );
 #else
         psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
@@ -569,7 +574,7 @@ describe:
 
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
     p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
-                                          var_GetBool( p_demux, "rtsp-kasenna" ), timeout );
+                                          var_GetBool( p_demux, "rtsp-kasenna" ), i_timeout );
 #else
     p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
                                           var_GetBool( p_demux, "rtsp-kasenna" ) );
@@ -1425,7 +1430,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
 
             /* Retrieve the starttime if possible */
-            p_sys->i_npt = p_sys->i_npt_start = p_sys->ms->playStartTime();
+            p_sys->i_npt_start = p_sys->ms->playStartTime();
 
             /* Retrieve the duration if possible */
             p_sys->i_npt_length = p_sys->ms->playEndTime();
@@ -1482,6 +1487,8 @@ static int RollOverTcp( demux_t *p_demux )
     p_sys->rtsp = NULL;
     p_sys->track = NULL;
     p_sys->i_track = 0;
+    p_sys->b_no_data = true;
+    p_sys->i_no_data_ti = 0;
 
     /* Reopen rtsp client */
     if( ( i_return = Connect( p_demux ) ) != VLC_SUCCESS )