Commit 48e39d44 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

block_t ** parameter is never NULL for audio decoding

parent 63227deb
...@@ -268,11 +268,9 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -268,11 +268,9 @@ 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; block_t *p_block = *pp_block;
if( !pp_block || !*pp_block ) return NULL; if( !p_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,11 +346,10 @@ static int DecoderOpen( vlc_object_t *p_this ) ...@@ -346,11 +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;
if( !pp_block || !*pp_block ) return NULL;
block_t *p_block = *pp_block; block_t *p_block = *pp_block;
if( !p_block ) return NULL;
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,12 +257,10 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -257,12 +257,10 @@ 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; block_t *p_block = *pp_block;
AVPacket pkt; AVPacket pkt;
if( !pp_block || !*pp_block ) return NULL; if( !p_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,11 +203,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -203,11 +203,9 @@ 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; block_t *p_block = *pp_block;
if( !pp_block || !*pp_block ) return NULL; if( !p_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,19 +527,20 @@ static void decoder_state_error( decoder_t *p_dec, ...@@ -527,19 +527,20 @@ 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( !pp_block || !*pp_block ) if( !p_block )
return NULL; return NULL;
if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
block_Release( *pp_block ); block_Release( p_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 = *pp_block; p_sys->p_block = p_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,13 +165,10 @@ static void Close (vlc_object_t *p_this) ...@@ -165,13 +165,10 @@ 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;
......
...@@ -1154,12 +1154,10 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -1154,12 +1154,10 @@ 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; block_t *p_block = *pp_block;
unsigned int i; unsigned int i;
if( !pp_block || !*pp_block ) return NULL; if( !p_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; block_t *p_block = *pp_block;
int i_error; int i_error;
#ifdef LOADER #ifdef LOADER
...@@ -547,11 +547,10 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) ...@@ -547,11 +547,10 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
} }
#endif #endif
if( pp_block == NULL || *pp_block == NULL ) if( p_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,15 +195,13 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -195,15 +195,13 @@ 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; block_t *p_block = *pp_block;
aout_buffer_t *p_aout_buffer = NULL; aout_buffer_t *p_aout_buffer = NULL;
#ifdef NDEBUG #ifdef NDEBUG
mtime_t start = mdate(); /* for statistics */ mtime_t start = mdate(); /* for statistics */
#endif #endif
if( !pp_block || !*pp_block ) return NULL; if( !p_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