]> git.sesse.net Git - vlc/commitdiff
livehttp: check opendts to be lowest dts available
authorIlkka Ollakka <ileoo@videolan.org>
Wed, 5 Jun 2013 13:24:19 +0000 (16:24 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Tue, 18 Jun 2013 18:17:36 +0000 (21:17 +0300)
modules/access_output/livehttp.c

index 0c85457765b1b8c371b7b95cd603b300491d7ce5..e92a40c9c10eb18254e3aee5216fd798858da561 100644 (file)
@@ -236,6 +236,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->segments_t = vlc_array_new();
 
     p_sys->stuffing_size = 0;
+    p_sys->i_opendts = VLC_TS_INVALID;
 
     p_sys->psz_indexPath = NULL;
     psz_idx = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index" );
@@ -897,6 +898,10 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             if ( p_sys->i_handle < 0 )
             {
                 p_sys->i_opendts = output ? output->i_dts : p_buffer->i_dts;
+                //For first segment we can get negative duration otherwise...?
+                if( ( p_sys->i_opendts != VLC_TS_INVALID ) &&
+                    ( p_buffer->i_dts < p_sys->i_opendts ) )
+                    p_sys->i_opendts = p_buffer->i_dts;
                 if ( openNextFile( p_access, p_sys ) < 0 )
                    return -1;
             }