[vlc-commits] access: live555: restore reset_pcr and add conditional flush
Francois Cartegnie
git at videolan.org
Sat May 20 13:56:05 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May 20 12:32:24 2017 +0200| [4c39d06a2fab7ccf72b3609d7ca5e076bb3ed606] | committer: Francois Cartegnie
access: live555: restore reset_pcr and add conditional flush
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4c39d06a2fab7ccf72b3609d7ca5e076bb3ed606
---
modules/access/live555.cpp | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 4aa7fa8b9d..a071f53e82 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -170,12 +170,11 @@ typedef struct
unsigned int i_buffer;
bool b_rtcp_sync;
- bool b_discontinuity;
+ bool b_flushing_discontinuity;
int i_next_block_flags;
char waiting;
int64_t i_lastpts;
int64_t i_pcr;
- int64_t i_offset;
double f_npt;
bool b_selected;
@@ -836,10 +835,9 @@ static int SessionsSetup( demux_t *p_demux )
tk->p_out_muxed = NULL;
tk->waiting = 0;
tk->b_rtcp_sync = false;
- tk->b_discontinuity = false;
+ tk->b_flushing_discontinuity = false;
tk->i_next_block_flags = 0;
tk->i_lastpts = VLC_TS_INVALID;
- tk->i_offset = 0;
tk->i_pcr = VLC_TS_INVALID;
tk->f_npt = 0.;
tk->b_selected = true;
@@ -1347,7 +1345,7 @@ static int Demux( demux_t *p_demux )
if( b_send_pcr )
{
mtime_t i_minpcr = VLC_TS_INVALID;
- bool b_discontinuity = false;
+ bool b_need_flush = false;
/* Check for gap in pts value */
for( i = 0; i < p_sys->i_track; i++ )
@@ -1359,15 +1357,15 @@ static int Demux( demux_t *p_demux )
continue;
/* Check for gap in pts value */
- b_discontinuity |= (tk->b_discontinuity);
+ b_need_flush |= (tk->b_flushing_discontinuity);
if( i_minpcr == VLC_TS_INVALID || i_minpcr > tk->i_pcr )
i_minpcr = tk->i_pcr;
}
- if( p_sys->i_pcr > VLC_TS_INVALID && b_discontinuity )
+ if( p_sys->i_pcr > VLC_TS_INVALID && b_need_flush )
{
- es_out_Control( p_demux->out, ES_OUT_MODIFY_PCR_SYSTEM, true, VLC_TS_0 + i_minpcr );
+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
p_sys->i_pcr = i_minpcr;
p_sys->f_npt = 0.;
@@ -1375,11 +1373,10 @@ static int Demux( demux_t *p_demux )
{
live_track_t *tk = p_sys->track[i];
tk->i_lastpts = VLC_TS_INVALID;
- tk->i_offset = 0;
tk->i_pcr = VLC_TS_INVALID;
tk->f_npt = 0.;
- tk->b_discontinuity = false;
- tk->i_next_block_flags = BLOCK_FLAG_DISCONTINUITY;
+ tk->b_flushing_discontinuity = false;
+ tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
}
if( p_sys->i_pcr != VLC_TS_INVALID )
es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr );
@@ -1654,7 +1651,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
live_track_t *tk = p_sys->track[i];
tk->b_rtcp_sync = false;
- tk->b_discontinuity = false;
+ tk->b_flushing_discontinuity = false;
+ tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
tk->i_lastpts = VLC_TS_INVALID;
tk->i_pcr = VLC_TS_INVALID;
}
@@ -2023,19 +2021,15 @@ static void StreamRead( void *p_private, unsigned int i_size,
{
msg_Dbg( p_demux, "tk->rtpSource->hasBeenSynchronizedUsingRTCP()" );
p_sys->b_rtcp_sync = tk->b_rtcp_sync = true;
- if( tk->i_pcr < i_pts )
+ if( tk->i_pcr != VLC_TS_INVALID )
{
- tk->i_offset = (tk->i_pcr > 0) ? i_pts + tk->i_pcr : 0;
- }
- else
- {
- tk->b_discontinuity = ( tk->i_pcr > VLC_TS_INVALID );
- tk->i_pcr = VLC_TS_INVALID;
+ tk->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+ const int64_t i_max_diff = CLOCK_FREQ * (( tk->fmt.i_cat == SPU_ES ) ? 60 : 1);
+ tk->b_flushing_discontinuity = (llabs(i_pts - tk->i_pcr) > i_max_diff);
+ tk->i_pcr = i_pts;
}
}
- i_pts -= tk->i_offset;
-
/* Update our global npt value */
if( tk->f_npt > 0 &&
( tk->f_npt < p_sys->f_npt_length || p_sys->f_npt_length <= 0 ) )
More information about the vlc-commits
mailing list