[vlc-commits] livehttp: place correct segment entries on playlist

Ilkka Ollakka git at videolan.org
Thu May 2 20:36:40 CEST 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu May  2 21:35:05 2013 +0300| [2f4528c07fd8c0e9d79b6a922c317e932e8c6a5a] | committer: Ilkka Ollakka

livehttp: place correct segment entries on playlist

This fixes the logical flaw that places segment info on playlist that
was next to remove and didn't place the newest segment info into
playlist.

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

 modules/access_output/livehttp.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index 2300a74..c89d849 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -495,11 +495,15 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
 {
 
     uint32_t i_firstseg;
+    unsigned i_index_offset = 0;
 
     if ( p_sys->i_numsegs == 0 || p_sys->i_segment < p_sys->i_numsegs )
         i_firstseg = 1;
     else
+    {
         i_firstseg = ( p_sys->i_segment - p_sys->i_numsegs ) + 1;
+        i_index_offset = vlc_array_count( p_sys->segments_t ) - p_sys->i_numsegs;
+    }
 
     // First update index
     if ( p_sys->psz_indexPath )
@@ -533,8 +537,8 @@ static int updateIndexAndDel( sout_access_out_t *p_access, sout_access_out_sys_t
 
         for ( uint32_t i = i_firstseg; i <= p_sys->i_segment; i++ )
         {
-            //scale to 0..numsegs-1
-            uint32_t index = i-i_firstseg;
+            //scale to i_index_offset..numsegs + i_index_offset
+            uint32_t index = i - i_firstseg + i_index_offset;
 
             output_segment_t *segment = (output_segment_t *)vlc_array_item_at_index( p_sys->segments_t, index );
             if( p_sys->key_uri &&



More information about the vlc-commits mailing list