Commit 09eaac81 authored by Laurent Aimar's avatar Laurent Aimar

Packetizers should trash all blocks with DISCONTINUITY or CORRUPTED flag set.

As a side effect, this workaround the AAC decoding problem after pause/seek
when going through our packetizer (eg: pause/seek with vlc VOD).

But the bug is still there : faad will stop decoding audio forever after
receiving a buffer full of 0 (at least with faad2-2.5 from
audiocoding.com, faad2 from mplayer svn does not show this problem)
parent b5d7934f
......@@ -256,9 +256,13 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
block_t *p_ret = p_dec->p_sys->p_block;
if( pp_block == NULL || *pp_block == NULL )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
block_Release( *pp_block );
return NULL;
}
p_block = *pp_block;
*pp_block = NULL;
......@@ -291,9 +295,13 @@ static block_t *PacketizeSub( decoder_t *p_dec, block_t **pp_block )
block_t *p_block;
if( pp_block == NULL || *pp_block == NULL )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
block_Release( *pp_block );
return NULL;
}
p_block = *pp_block;
*pp_block = NULL;
......
......@@ -311,7 +311,14 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_pic;
if( !pp_block || !*pp_block ) return NULL;
if( !pp_block || !*pp_block )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
......@@ -400,7 +407,13 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
block_t *p_ret = NULL;
uint8_t *p;
if( !pp_block || !*pp_block ) return NULL;
if( !pp_block || !*pp_block )
return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
block_Release( *pp_block );
return NULL;
}
p_block = *pp_block;
*pp_block = NULL;
......
......@@ -216,6 +216,12 @@ 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) )
{
block_Release( *pp_block );
return NULL;
}
p_block = *pp_block;
*pp_block = NULL; /* Don't reuse this block */
......@@ -257,10 +263,11 @@ static block_t *ADTSPacketizeBlock( decoder_t *p_dec, block_t **pp_block )
block_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags&BLOCK_FLAG_DISCONTINUITY )
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_state = STATE_NOSYNC;
block_Release( *pp_block );
return NULL;
}
block_BytestreamPush( &p_sys->bytestream, *pp_block );
......
......@@ -224,7 +224,7 @@ 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 )
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 );
......
......@@ -194,12 +194,7 @@ 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_Release( *pp_block );
return NULL;
}
if( (*pp_block)->i_flags & BLOCK_FLAG_CORRUPTED )
if( (*pp_block)->i_flags & (BLOCK_FLAG_CORRUPTED|BLOCK_FLAG_DISCONTINUITY) )
{
p_sys->i_state = STATE_NOSYNC;
if( p_sys->p_frame )
......
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