[vlc-commits] livehttp: don' t remove previous playlist on open if segment-number is given

Ilkka Ollakka git at videolan.org
Fri Dec 5 10:50:56 CET 2014


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Dec  4 16:45:36 2014 +0200| [edeb3ffabbc1ec9c957206158834269afa21fafb] | committer: Ilkka Ollakka

livehttp: don't remove previous playlist on open if segment-number is given

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edeb3ffabbc1ec9c957206158834269afa21fafb
---

 modules/access_output/livehttp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index 19fb9aa..7a51ac8 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -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
     {



More information about the vlc-commits mailing list