]> git.sesse.net Git - vlc/commitdiff
livehttp: don't remove previous playlist on open if segment-number is given
authorIlkka Ollakka <ileoo@videolan.org>
Thu, 4 Dec 2014 14:45:36 +0000 (16:45 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Fri, 5 Dec 2014 09:49:42 +0000 (11:49 +0200)
If we provide initial segment-number, most likely we want to continue
where we have left of, so leave old playlist-file there and just
overwrite it when we updated it.

default initial-segment-number is 1 so don't test against 0

modules/access_output/livehttp.c

index 19fb9aaebbda11c555e4ab0e052401cb1d2c6ac0..7a51ac8a96a8694eebb1604ce3d443a56540d412 100644 (file)
@@ -264,7 +264,8 @@ static int Open( vlc_object_t *p_this )
         }
         path_sanitize( psz_tmp );
         p_sys->psz_indexPath = psz_tmp;
-        vlc_unlink( p_sys->psz_indexPath );
+        if( p_sys->i_initial_segment != 1 )
+            vlc_unlink( p_sys->psz_indexPath );
     }
 
     p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" );
@@ -291,7 +292,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     p_sys->i_handle = -1;
-    p_sys->i_segment = p_sys->i_initial_segment > 0 ? p_sys->i_initial_segment -1 : 0;
+    p_sys->i_segment = p_sys->i_initial_segment-1;
     p_sys->psz_cursegPath = NULL;
 
     p_access->pf_write = Write;
@@ -564,7 +565,7 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
     if ( p_sys->i_numsegs == 0 ||
          p_sys->i_segment < ( p_sys->i_numsegs + p_sys->i_initial_segment ) )
     {
-        i_firstseg = p_sys->i_initial_segment == 0 ? 1 : p_sys->i_initial_segment;
+        i_firstseg = p_sys->i_initial_segment;
     }
     else
     {