livehttp: take block length in account when checking segment length
authorIlkka Ollakka <ileoo@videolan.org>
Thu, 28 Feb 2013 11:01:17 +0000 (13:01 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Thu, 28 Feb 2013 11:01:56 +0000 (13:01 +0200)
modules/access_output/livehttp.c

index d815dea..25db4a6 100644 (file)
@@ -456,7 +456,10 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             p_sys->block_buffer = NULL;
 
 
-            if( p_sys->i_handle > 0 && ( p_buffer->i_dts - p_sys->i_opendts ) >= p_sys->i_seglenm )
+            if( p_sys->i_handle > 0 &&
+                ( p_buffer->i_dts - p_sys->i_opendts +
+                  p_buffer->i_length * CLOCK_FREQ / INT64_C(1000000)
+                ) >= p_sys->i_seglenm )
                 closeCurrentSegment( p_access, p_sys, false );
 
             if ( p_sys->i_handle < 0 )