Commit 84190851 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

demux: ogg: don't send invalid dts stamps and use last pts as chained pcr

(cherry picked from commit 918f44532669674303f492d0781fa408d0169dd5)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2e8ad115
......@@ -302,6 +302,7 @@ static int Demux( demux_t * p_demux )
}
Ogg_EndOfStream( p_demux );
p_sys->b_chained_boundary = true;
p_sys->i_nzpcr_offset = p_sys->i_nzlast_pts;
}
if( Ogg_BeginningOfStream( p_demux ) != VLC_SUCCESS )
......@@ -397,8 +398,7 @@ static int Demux( demux_t * p_demux )
{
msg_Err( p_demux, "Broken Ogg stream (serialno) mismatch" );
Ogg_ResetStream( p_stream );
p_sys->i_nzpcr_offset = (p_sys->i_pcr >= VLC_TS_INVALID) ?
p_sys->i_pcr - VLC_TS_0 : 0;
p_sys->i_nzpcr_offset = p_sys->i_nzlast_pts;
ogg_stream_reset_serialno( &p_stream->os, ogg_page_serialno( &p_sys->current_page ) );
}
......@@ -1101,8 +1101,19 @@ static void Ogg_SendOrQueueBlocks( demux_t *p_demux, logical_stream_t *p_stream,
temp = temp->p_next;
tosend->p_next = NULL;
DemuxDebug( msg_Dbg( p_demux, "block sent from preparse > pts %"PRId64" spcr %"PRId64" pcr %"PRId64,
tosend->i_pts, p_stream->i_pcr, p_ogg->i_pcr ); )
if( tosend->i_pts < VLC_TS_0 )
{
/* Don't send metadata from chained streams */
block_Release( tosend );
continue;
}
else if( tosend->i_dts < VLC_TS_0 )
{
tosend->i_dts = tosend->i_pts;
}
DemuxDebug( msg_Dbg( p_demux, "block sent from preparse > dts %"PRId64" pts %"PRId64" spcr %"PRId64" pcr %"PRId64,
tosend->i_dts, tosend->i_pts, p_stream->i_pcr, p_ogg->i_pcr ); )
es_out_Send( p_demux->out, p_stream->p_es, tosend );
if ( p_ogg->i_pcr < VLC_TS_0 && i_firstpts > VLC_TS_INVALID )
......@@ -1116,6 +1127,7 @@ static void Ogg_SendOrQueueBlocks( demux_t *p_demux, logical_stream_t *p_stream,
if ( p_block )
{
p_ogg->i_nzlast_pts = (p_block->i_pts > VLC_TS_INVALID) ? p_block->i_pts - VLC_TS_0 : 0;
DemuxDebug( msg_Dbg( p_demux, "block sent directly > pts %"PRId64" spcr %"PRId64" pcr %"PRId64,
p_block->i_pts, p_stream->i_pcr, p_ogg->i_pcr ) );
es_out_Send( p_demux->out, p_stream->p_es, p_block );
......
......@@ -179,6 +179,7 @@ struct demux_sys_t
* the sub-streams */
mtime_t i_pcr;
mtime_t i_nzpcr_offset;
mtime_t i_nzlast_pts;
/* informative only */
mtime_t i_pcr_jitter;
int64_t i_access_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment