Commit ab1b0ebe authored by Laurent Aimar's avatar Laurent Aimar

Improved BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED handling in packetizers.

(I do not reset timestamp on purpose, it will at least break demuxer using
packetizer)
parent 07ed62b5
......@@ -168,16 +168,23 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
/* We've just started the stream, wait for the first PTS. */
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
}
// aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
p_sys->i_state = STATE_NOSYNC;
/* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
......
......@@ -170,16 +170,23 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
/* We've just started the stream, wait for the first PTS. */
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
}
// aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
p_sys->i_state = STATE_NOSYNC;
/* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
......
......@@ -376,6 +376,18 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
}
// aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( !p_sys->b_stream_info ) ProcessHeader( p_dec );
if( p_sys->stream_info.channels > 6 )
......@@ -396,11 +408,6 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
aout_DateSet( &p_sys->end_date, (*pp_block)->i_pts );
}
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
while( 1 )
......
......@@ -196,17 +196,24 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
/* We've just started the stream, wait for the first PTS. */
msg_Dbg( p_dec, "waiting for PTS" );
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
}
// aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
p_sys->i_state = STATE_NOSYNC;
/* We've just started the stream, wait for the first PTS. */
msg_Dbg( p_dec, "waiting for PTS" );
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
......
......@@ -313,9 +313,20 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->slice.i_frame_type = 0;
p_sys->b_slice = VLC_FALSE;
}
block_Release( *pp_block );
return NULL;
}
......
......@@ -218,6 +218,7 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
//aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
......@@ -257,15 +258,21 @@ static block_t *ADTSPacketizeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
/* We've just started the stream, wait for the first PTS. */
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
}
//aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
p_sys->i_state = STATE_NOSYNC;
/* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block );
return NULL;
}
......
......@@ -224,12 +224,26 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if( pp_block == NULL || *pp_block == NULL ) return NULL;
if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
if( p_sys->p_frame ) block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
}
// p_sys->i_interpolated_pts =
// p_sys->i_interpolated_dts =
// p_sys->i_last_ref_pts =
// p_sys->i_last_time_ref =
// p_sys->i_time_ref =
// p_sys->i_last_time =
// p_sys->i_last_timeincr = 0;
block_Release( *pp_block );
return NULL;
}
......
......@@ -115,7 +115,6 @@ struct decoder_sys_t
int i_progressive_frame;
mtime_t i_interpolated_dts;
mtime_t i_old_duration;
mtime_t i_last_ref_pts;
vlc_bool_t b_second_field;
......@@ -183,7 +182,6 @@ static int Open( vlc_object_t *p_this )
p_sys->b_inited = 0;
p_sys->i_interpolated_dts = 0;
p_sys->i_old_duration = 0;
p_sys->i_last_ref_pts = 0;
p_sys->b_second_field = 0;
......@@ -236,19 +234,28 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
p_sys->b_discontinuity = VLC_TRUE;
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame_slice = VLC_FALSE;
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
p_sys->b_discontinuity = VLC_TRUE;
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame_slice = VLC_FALSE;
}
// p_sys->i_interpolated_dts =
// p_sys->i_last_ref_pts = 0;
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
while( 1 )
......
......@@ -194,13 +194,20 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
if( pp_block == NULL || *pp_block == NULL )
return NULL;
if( (*pp_block)->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamFlush( &p_sys->bytestream );
if( p_sys->p_frame )
block_ChainRelease( p_sys->p_frame );
p_sys->p_frame = NULL;
p_sys->pp_last = &p_sys->p_frame;
p_sys->b_frame = VLC_FALSE;
}
// p_sys->i_interpolated_dts = 0;
block_Release( *pp_block );
return NULL;
}
......
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