From: Ilkka Ollakka Date: Wed, 5 Jun 2013 13:24:19 +0000 (+0300) Subject: livehttp: check opendts to be lowest dts available X-Git-Tag: 2.1.0-git~95 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f3b30afc36fb9bac57a485f33c9c53b711e9e9ae;p=vlc livehttp: check opendts to be lowest dts available --- diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c index 0c85457765..e92a40c9c1 100644 --- a/modules/access_output/livehttp.c +++ b/modules/access_output/livehttp.c @@ -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; }