Commit ce6db786 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Ilkka Ollakka

codec: don't drop blocks marked BLOCK_FLAG_DISCONTINUITY

parent c736ebc0
......@@ -174,26 +174,24 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
{
if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
date_Set( &p_sys->end_date, 0 );
if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
block_Release( *pp_block );
*pp_block = NULL;
return NULL;
}
date_Set( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
date_Set( &p_sys->end_date, 0 );
}
if( !date_Get( &p_sys->end_date ) && (*pp_block)->i_pts <= VLC_TS_INVALID)
{
/* We've just started the stream, wait for the first PTS. */
block_Release( *pp_block );
*pp_block = NULL;
return NULL;
}
......
......@@ -276,6 +276,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
*pp_block = NULL; /* So the packet doesn't get re-sent */
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
......
......@@ -310,6 +310,15 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
p_block = *pp_block;
*pp_block = NULL; /* So the packet doesn't get re-sent */
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
......@@ -371,4 +380,3 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
*pi_bits = i_bits;
return p_block;
}
......@@ -314,6 +314,12 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
goto skip;
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
......
......@@ -173,6 +173,12 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
p_block = *pp_block;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
arib_parser_t *p_parser = arib_get_parser( p_sys->p_arib_instance );
arib_decoder_t *p_decoder = arib_get_decoder( p_sys->p_arib_instance );
if ( p_parser && p_decoder )
......
......@@ -261,7 +261,7 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_delayed_open )
goto end;
if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
avcodec_flush_buffers( ctx );
date_Set( &p_sys->end_date, VLC_TS_INVALID );
......@@ -272,9 +272,9 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
goto end;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
avcodec_flush_buffers( ctx );
date_Set( &p_sys->end_date, VLC_TS_INVALID );
}
......
......@@ -124,13 +124,13 @@ static subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
block_t *block = *block_ptr;
if (block->i_flags & (BLOCK_FLAG_CORRUPTED)) {
block_Release(block);
avcodec_flush_buffers(sys->p_context);
return NULL;
if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED)) {
if (block->i_flags & BLOCK_FLAG_CORRUPTED) {
avcodec_flush_buffers(sys->p_context);
block_Release(block);
return NULL;
}
}
if (block->i_flags & BLOCK_FLAG_DISCONTINUITY)
avcodec_flush_buffers(sys->p_context);
if (block->i_buffer <= 0) {
block_Release(block);
......
......@@ -531,12 +531,13 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_sys->i_pts = VLC_TS_INVALID; /* To make sure we recover properly */
p_sys->i_late_frames = 0;
#if 0
/* NOTE: data is good only the timeline changed so do not flush decoder */
post_mt( p_sys );
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
avcodec_flush_buffers( p_context );
wait_mt( p_sys );
#endif
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
......
......@@ -96,18 +96,13 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
BPGImageInfo img_info;
if( !pp_block || !*pp_block )
{
return NULL;
}
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
goto error;
/* Decode picture */
......@@ -163,15 +158,10 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
block_Release( p_block );
*pp_block = NULL;
return p_pic;
error:
block_Release( p_block );
*pp_block = NULL;
return NULL;
}
......
......@@ -143,7 +143,7 @@ static picture_t *Decode( decoder_t *p_dec, block_t **pp_block )
return NULL;
p_block = *pp_block;
if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_packet = 0;
goto exit;
......@@ -170,7 +170,8 @@ static picture_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
exit:
block_Release( p_block ); *pp_block = NULL;
block_Release( p_block );
*pp_block = NULL;
return p_pic;
}
......
......@@ -443,10 +443,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
if( p_block )
{
if( ( p_block->i_flags&(BLOCK_FLAG_CORRUPTED) ) == 0 )
if( ( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) ) == 0 )
{
/* Valid input block, so we can send to HW to decode */
BC_STATUS status = BC_FUNC_PSYS(DtsProcInput)( p_sys->bcm_handle,
p_block->p_buffer,
p_block->i_buffer,
......
......@@ -169,6 +169,12 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
if( !(p_spu = Reassemble( p_dec, p_block )) ) return NULL;
/* Parse and decode */
......
......@@ -127,6 +127,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
*pp_block = NULL;
if( stream != NULL
&& p_block->i_buffer > 0
......
......@@ -174,16 +174,18 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
date_Set( &p_sys->end_date, 0 );
block_Release( *pp_block );
return NULL;
if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
block_Release( *pp_block );
*pp_block = NULL;
return NULL;
}
}
if( (*pp_block)->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
if( !date_Get( &p_sys->end_date ) && (*pp_block)->i_pts <= VLC_TS_INVALID )
{
......
......@@ -402,9 +402,19 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_pts = VLC_TS_INVALID;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
}
/* configure for SD res in case DDS is not present */
/* a change of PTS is a good indication we must get a new DDS */
if (p_sys->i_pts != p_block->i_pts)
if( p_sys->i_pts != p_block->i_pts )
default_dds_init( p_dec );
p_sys->i_pts = p_block->i_pts;
......
......@@ -209,11 +209,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags&(BLOCK_FLAG_CORRUPTED) )
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
{
block_Release( p_block );
return NULL;
date_Set( &p_sys->date, 0 );
if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
{
block_Release( p_block );
return NULL;
}
}
/* Remove ADTS header if we have decoder specific config */
......
......@@ -500,10 +500,15 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
if( (*pp_block)->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
{
block_Release( *pp_block );
return NULL;
date_Set( &p_sys->end_date, 0 );
if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( *pp_block );
*pp_block = NULL;
return NULL;
}
}
if( !p_sys->b_stream_info )
......
......@@ -208,12 +208,17 @@ static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
{
date_Set (&p_sys->end_date, 0);
date_Set (&p_sys->end_date, VLC_TS_INVALID);
//fluid_synth_system_reset (p_sys->synth);
fluid_synth_program_reset (p_sys->synth);
for (unsigned channel = 0; channel < 16; channel++)
for (unsigned note = 0; note < 128; note++)
fluid_synth_noteoff (p_sys->synth, channel, note);
if (p_block->i_flags & BLOCK_FLAG_CORRUPTED)
{
block_Release(p_block);
return NULL;
}
}
if (p_block->i_pts > VLC_TS_INVALID && !date_Get (&p_sys->end_date))
......
......@@ -219,9 +219,19 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( pp_block == NULL )
return NULL;
block_t *p_block = *pp_block;
*pp_block = NULL;
if( p_block == NULL )
return NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block);
return NULL;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
......
......@@ -198,11 +198,11 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
}
p_block = *pp_block;
*pp_block = NULL;
if (p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......@@ -261,8 +261,6 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
block_Release(p_block);
*pp_block = NULL;
return p_pic;
error:
......@@ -271,8 +269,6 @@ error:
free(p_row_pointers);
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......
......@@ -468,6 +468,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
......
......@@ -306,13 +306,14 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
p_block = *pp_block;
if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_max_stop = VLC_TS_INVALID;
block_Release( p_block );
return NULL;
}
*pp_block = NULL;
if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' )
{
......
......@@ -327,6 +327,15 @@ static block_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
*pp_block = NULL; /* So the packet doesn't get re-sent */
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
......
......@@ -780,6 +780,7 @@ static void *DecodeSync(decoder_t *p_dec, block_t **pp_block)
if (p_block->i_flags & (BLOCK_FLAG_CORRUPTED))
{
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......@@ -802,6 +803,7 @@ error:
msg_Err(p_dec, "Error in DecodeSync()");
if (p_block)
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......@@ -842,6 +844,7 @@ static void *DecodeAsync(decoder_t *p_dec, block_t **pp_block)
if (p_block->i_flags & (BLOCK_FLAG_CORRUPTED))
{
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......@@ -896,6 +899,7 @@ static void *DecodeAsync(decoder_t *p_dec, block_t **pp_block)
error:
msg_Err(p_dec, "Error in DecodeAsync()");
block_Release(p_block);
*pp_block = NULL;
return NULL;
}
......
......@@ -200,18 +200,19 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
block_t *p_block = pp_block ? *pp_block : NULL;
if (p_block) {
if( p_block->i_flags&(BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
date_Set( &p_sys->end_date, 0 );
block_Release( p_block );
return NULL;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
if (p_block)
{
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
date_Set( &p_sys->end_date, 0 );
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
block_Release( p_block );
*pp_block = NULL;
return NULL;
}
p_sys->b_discontinuity = true;
}
......
......@@ -93,10 +93,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
goto error;
}
if( p_block->i_flags & ( BLOCK_FLAG_CORRUPTED ) )
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
{
date_Set( &p_sys->end_date, 0 );
goto error;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
goto error;
}
/* Feed mpg123 with raw data */
......
......@@ -1539,7 +1539,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
return 0;
}
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
if(!p_sys->in.b_flushed)
......@@ -1657,7 +1657,7 @@ block_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
return 0;
}
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
date_Set( &p_sys->end_date, 0 );
......
......@@ -367,9 +367,22 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block;
*pp_block = NULL; /* To avoid being fed the same packet again */
if( !p_block )
return NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
/* Date management */
if( p_block && p_block->i_pts > VLC_TS_INVALID &&
if( p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......@@ -378,15 +391,10 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
if( !date_Get( &p_sys->end_date ) )
{
/* We've just started the stream, wait for the first PTS. */
if( p_block ) block_Release( p_block );
block_Release( p_block );
return NULL;
}
*pp_block = NULL; /* To avoid being fed the same packet again */
if( !p_block )
return NULL;
block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket,
p_block->i_nb_samples,
(int)p_block->i_length );
......
......@@ -143,6 +143,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
block_t *p_block = *pp_block;
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->pts, p_block->i_dts );
if( p_block->i_pts <= VLC_TS_INVALID && p_block->i_dts <= VLC_TS_INVALID &&
!date_Get( &p_sys->pts ) )
{
......
......@@ -760,7 +760,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* reset the decoder when seeking as the decode in progress is invalid */
/* discard the block as it is just a null magic block */
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY ) {
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) ) {
schro_decoder_reset( p_sys->p_schro );
p_sys->i_lastpts = VLC_TS_INVALID;
......
......@@ -534,6 +534,9 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block;
if( p_block && p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
date_Set( &p_sys->end_date, 0 );
/* Date management */
if( p_block && p_block->i_pts > VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
......
......@@ -207,6 +207,12 @@ static block_t *Reassemble( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
}
if( p_sys->i_spu_size <= 0 &&
( p_block->i_pts <= VLC_TS_INVALID || p_block->i_buffer < 4 ) )
{
......
......@@ -112,7 +112,8 @@ static subpicture_t *Decode(decoder_t *dec, block_t **block)
subpicture_t *sub = NULL;
block_t *b = *block; *block = NULL;
block_t *b = *block;
*block = NULL;
if (b->i_flags & (BLOCK_FLAG_CORRUPTED))
goto exit;
if (b->i_buffer < 128)
......
......@@ -329,7 +329,9 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL;
p_block = *pp_block;
if( p_block->i_flags & (BLOCK_FLAG_CORRUPTED) )
*pp_block = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
return NULL;
......@@ -338,8 +340,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_spu = ParseText( p_dec, p_block );
block_Release( p_block );
*pp_block = NULL;
return p_spu;
}
......@@ -366,6 +366,9 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
subpicture_t *p_spu = NULL;
char *psz_subtitle = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
return NULL;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
{
......
......@@ -497,6 +497,9 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
subpicture_t *p_spu = NULL;
char *psz_subtitle = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
return NULL;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
{
......
......@@ -223,6 +223,9 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
subpicture_t *p_spu = NULL;
char *psz_subtitle = NULL;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
return NULL;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
{
......
......@@ -424,9 +424,17 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
block_t *p_block = *pp_block;
void *p_buf;
if( ( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) != 0 )
*pp_block = NULL; /* To avoid being fed the same packet again */
if( !p_block )
return NULL;
if( ( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY ) != 0 )
p_sys->i_pts = p_block->i_pts;
if( ( p_block->i_flags & BLOCK_FLAG_CORRUPTED ) != 0 )
{
/* Don't send the the first packet after a discontinuity to
/* Don't send the a corrupted packet to
* theora_decode, otherwise we get purple/green display artifacts
* appearing in the video output */
block_Release(p_block);
......@@ -439,8 +447,6 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
p_sys->i_pts = p_block->i_pts;
}
*pp_block = NULL; /* To avoid being fed the same packet again */
if( p_sys->b_packetizer )
{
/* Date management */
......