Commit f213c439 authored by Ilkka Ollakka's avatar Ilkka Ollakka

Revert "codec: don't drop discontinue blocks"

This reverts commit 5e36cb2c.
parent d0c57481
......@@ -174,7 +174,7 @@ 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 )
{
......@@ -185,10 +185,6 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
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)
{
......
......@@ -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_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
avcodec_flush_buffers( ctx );
date_Set( &p_sys->end_date, VLC_TS_INVALID );
......@@ -272,11 +272,6 @@ 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 );
}
/* We've just started the stream, wait for the first PTS. */
if( !date_Get( &p_sys->end_date ) && p_block->i_pts <= VLC_TS_INVALID )
......
......@@ -124,13 +124,11 @@ static subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
block_t *block = *block_ptr;
if (block->i_flags & (BLOCK_FLAG_CORRUPTED)) {
if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) {
block_Release(block);
avcodec_flush_buffers(sys->p_context);
return NULL;
}
if (block->i_flags & BLOCK_FLAG_DISCONTINUITY)
avcodec_flush_buffers(sys->p_context);
if (block->i_buffer <= 0) {
block_Release(block);
......
......@@ -102,7 +102,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
block_Release(p_block);
*pp_block = 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_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_packet = 0;
goto exit;
......
......@@ -443,7 +443,7 @@ 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_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) == 0 )
{
/* Valid input block, so we can send to HW to decode */
......
......@@ -404,7 +404,7 @@ 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_CORRUPTED) ) != 0 )
if( ( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) != 0 )
{
/* Don't send the the first packet after a discontinuity to
* daala_decode, otherwise we get purple/green display artifacts
......
......@@ -130,7 +130,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( stream != NULL
&& p_block->i_buffer > 0
&& !(p_block->i_flags & (BLOCK_FLAG_CORRUPTED)) )
&& !(p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) )
{
fwrite( p_block->p_buffer, 1, p_block->i_buffer, stream );
msg_Dbg( p_dec, "dumped %zu bytes", p_block->i_buffer );
......
......@@ -174,16 +174,17 @@ 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 );
if( (*pp_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( *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 )
{
......
......@@ -210,7 +210,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
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;
......
......@@ -500,7 +500,7 @@ 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;
......
......@@ -679,11 +679,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->b_prerolled = false;
}
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
block_Release( p_block );
goto done;
}
block_Release( p_block );
goto done;
}
if( likely( p_block->i_buffer ) )
......
......@@ -199,7 +199,7 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
p_block = *pp_block;
if (p_block->i_flags & BLOCK_FLAG_CORRUPTED )
if (p_block->i_flags & BLOCK_FLAG_DISCONTINUITY)
{
block_Release(p_block);
*pp_block = NULL;
......
......@@ -480,12 +480,9 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
vlc_mutex_unlock( &p_sys->lock );
}
#endif
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{
p_sys->i_max_stop = VLC_TS_INVALID;
block_Release( p_block );
return NULL;
}
p_sys->i_max_stop = VLC_TS_INVALID;
block_Release( p_block );
return NULL;
}
/* Block to Kate packet */
......
......@@ -307,7 +307,7 @@ 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) )
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_max_stop = VLC_TS_INVALID;
block_Release( p_block );
......
......@@ -261,7 +261,7 @@ static picture_t *DecodeBlock( 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_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) )
Reset( p_dec );
while( 1 )
......
......@@ -777,7 +777,7 @@ static void *DecodeSync(decoder_t *p_dec, block_t **pp_block)
return NULL;
block_t *p_block = *pp_block;
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;
......@@ -839,9 +839,10 @@ static void *DecodeAsync(decoder_t *p_dec, block_t **pp_block)
return NULL;
block_t *p_block = *pp_block;
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;
}
......
......@@ -201,18 +201,17 @@ 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) )
if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
block_BytestreamEmpty( &p_sys->bytestream );
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 )
{
date_Set( &p_sys->end_date, 0 );
p_sys->b_discontinuity = true;
return NULL;
}
if( !date_Get( &p_sys->end_date ) && p_block->i_pts <= VLC_TS_INVALID )
......@@ -293,6 +292,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "emulated startcode" );
block_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
p_sys->b_discontinuity = true;
break;
}
......@@ -367,6 +367,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
msg_Dbg( p_dec, "emulated startcode on next frame" );
block_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
p_sys->b_discontinuity = true;
break;
}
......
......@@ -93,7 +93,7 @@ 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;
......
......@@ -205,7 +205,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
p_sys->b_error = false;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
block_Release( p_block ); *pp_block = NULL;
return NULL;
......
......@@ -416,7 +416,7 @@ static subpicture_t *Decode(decoder_t *dec, block_t **block)
subpicture_t *sub_first = NULL;
subpicture_t **sub_last = &sub_first;
if (b->i_flags & (BLOCK_FLAG_CORRUPTED))
if (b->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
goto exit;
while (b->i_buffer > 3) {
......
......@@ -137,7 +137,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( pp_block == NULL || *pp_block == NULL ) return NULL;
p_block = *pp_block;
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
block_Release( p_block ); *pp_block = NULL;
return NULL;
......
......@@ -113,7 +113,7 @@ static subpicture_t *Decode(decoder_t *dec, block_t **block)
subpicture_t *sub = NULL;
block_t *b = *block; *block = NULL;
if (b->i_flags & (BLOCK_FLAG_CORRUPTED))
if (b->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
goto exit;
if (b->i_buffer < 128)
goto exit;
......
......@@ -329,7 +329,7 @@ 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) )
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
block_Release( p_block );
return NULL;
......
......@@ -282,7 +282,7 @@ 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) ) ||
if( ( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) ||
p_block->i_buffer < sizeof(uint16_t) )
{
block_Release( p_block );
......
......@@ -234,7 +234,7 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
uint16_t i_expected_image;
uint8_t i_packet, i_expected_packet;
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;
......
......@@ -136,7 +136,7 @@ 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)
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
block_Release( p_block );
return NULL;
......
......@@ -62,14 +62,13 @@ static block_t *Decode(decoder_t *dec, block_t **block_ptr)
return NULL;
block_t *block = *block_ptr;
if (block->i_flags & BLOCK_FLAG_CORRUPTED) {
if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED)) {
if (block->i_flags & BLOCK_FLAG_CORRUPTED) {
}
date_Set(&sys->end_date, 0);
block_Release(block);
return NULL;
}
if (block->i_flags & BLOCK_FLAG_DISCONTINUITY) {
date_Set(&sys->end_date, 0);
}
if (block->i_pts > VLC_TS_INVALID &&
block->i_pts != date_Get(&sys->end_date))
......
......@@ -929,7 +929,7 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
p_block = *pp_block;
if (likely(p_block != NULL)) {
if (unlikely(p_block->i_flags&(BLOCK_FLAG_CORRUPTED))) {
if (unlikely(p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))) {
if (likely(p_sys->b_started)) {
@synchronized(p_sys->outputTimeStamps) {
[p_sys->outputTimeStamps removeAllObjects];
......
......@@ -72,7 +72,7 @@ static picture_t *Decode(decoder_t *dec, block_t **pp_block)
if (!block)
return NULL;
if (block->i_flags & (BLOCK_FLAG_CORRUPTED)) {
if (block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
block_Release(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