Commit a8d9ae66 authored by Laurent Aimar's avatar Laurent Aimar

Revert "block_t ** parameter is never NULL for audio decoding"

This reverts commit 48e39d44.

 It is needed to apply the patch allowing to flush the packetizer/decoders
without having to change the API for now.
parent bf1b0d63
...@@ -268,9 +268,11 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -268,9 +268,11 @@ static int OpenDecoder( vlc_object_t *p_this )
static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block; block_t *p_block;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
if( 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 ) ) p_block->i_pts != date_Get( &p_sys->end_date ) )
......
...@@ -346,9 +346,10 @@ static int DecoderOpen( vlc_object_t *p_this ) ...@@ -346,9 +346,10 @@ static int DecoderOpen( vlc_object_t *p_this )
static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
block_t *p_block = *pp_block;
if( 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 ) ) p_block->i_pts != date_Get( &p_sys->end_date ) )
......
...@@ -257,10 +257,12 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -257,10 +257,12 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
int i_used, i_output; int i_used, i_output;
aout_buffer_t *p_buffer; aout_buffer_t *p_buffer;
block_t *p_block = *pp_block; block_t *p_block;
AVPacket pkt; AVPacket pkt;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
if( !p_sys->p_context->extradata_size && p_dec->fmt_in.i_extra && if( !p_sys->p_context->extradata_size && p_dec->fmt_in.i_extra &&
p_sys->b_delayed_open) p_sys->b_delayed_open)
......
...@@ -203,9 +203,11 @@ static int Open( vlc_object_t *p_this ) ...@@ -203,9 +203,11 @@ static int Open( vlc_object_t *p_this )
static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block; block_t *p_block;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
......
...@@ -527,20 +527,19 @@ static void decoder_state_error( decoder_t *p_dec, ...@@ -527,20 +527,19 @@ static void decoder_state_error( decoder_t *p_dec,
static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block;
if( !p_block ) if( !pp_block || !*pp_block )
return NULL; return NULL;
if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
block_Release( p_block ); block_Release( *pp_block );
return NULL; return NULL;
} }
if( !p_sys->b_stream_info ) if( !p_sys->b_stream_info )
ProcessHeader( p_dec ); ProcessHeader( p_dec );
p_sys->p_block = p_block; p_sys->p_block = *pp_block;
*pp_block = NULL; *pp_block = NULL;
if( p_sys->p_block->i_pts > VLC_TS_INVALID && if( p_sys->p_block->i_pts > VLC_TS_INVALID &&
......
...@@ -165,10 +165,13 @@ static void Close (vlc_object_t *p_this) ...@@ -165,10 +165,13 @@ static void Close (vlc_object_t *p_this)
static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block) static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
{ {
block_t *p_block;
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block;
aout_buffer_t *p_out = NULL; aout_buffer_t *p_out = NULL;
if (pp_block == NULL)
return NULL;
p_block = *pp_block;
if (p_block == NULL) if (p_block == NULL)
return NULL; return NULL;
*pp_block = NULL; *pp_block = NULL;
......
...@@ -1155,10 +1155,12 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -1155,10 +1155,12 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
aout_buffer_t *p_buffer = 0; aout_buffer_t *p_buffer = 0;
OMX_BUFFERHEADERTYPE *p_header; OMX_BUFFERHEADERTYPE *p_header;
OMX_ERRORTYPE omx_error; OMX_ERRORTYPE omx_error;
block_t *p_block = *pp_block; block_t *p_block;
unsigned int i; unsigned int i;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
/* Check for errors from codec */ /* Check for errors from codec */
if(p_sys->b_error) if(p_sys->b_error)
......
...@@ -528,7 +528,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) ...@@ -528,7 +528,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block; block_t *p_block;
int i_error; int i_error;
#ifdef LOADER #ifdef LOADER
...@@ -547,10 +547,11 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) ...@@ -547,10 +547,11 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
} }
#endif #endif
if( p_block == NULL ) if( pp_block == NULL || *pp_block == NULL )
{ {
return NULL; return NULL;
} }
p_block = *pp_block;
if( p_sys->i_out_frames > 0 && p_sys->i_out >= p_sys->i_out_frames ) if( p_sys->i_out_frames > 0 && p_sys->i_out >= p_sys->i_out_frames )
{ {
......
...@@ -195,10 +195,12 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -195,10 +195,12 @@ static int OpenDecoder( vlc_object_t *p_this )
static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block ) static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block = *pp_block; block_t *p_block;
aout_buffer_t *p_aout_buffer = NULL; aout_buffer_t *p_aout_buffer = NULL;
if( !p_block ) return NULL; if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
......
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