(cherry picked from commit
21ab6be22e7c1831cebf023fd53bd7ffbfad22f6) (edited)
edited:
- on 3.0 DecodeBlock returns a picture_t, not an error code
Gbp-Pq: Name 0088-codec-avcodec-check-open-codec-return-value.patch
&& !avcodec_is_open( ctx ) )
{
InitDecoderConfig( p_dec, ctx );
- OpenAudioCodec( p_dec );
+ if( OpenAudioCodec( p_dec ) < 0 )
+ {
+ if( pp_block != NULL && *pp_block != NULL )
+ block_Release( *pp_block );
+ return VLCDEC_ECRITICAL;
+ }
}
if( !avcodec_is_open( ctx ) )
bool eos_spotted = false;
- block_t *p_block;
+ block_t *p_block = pp_block ? *pp_block : NULL;
vlc_tick_t current_time;
if( !p_context->extradata_size && p_dec->fmt_in.i_extra )
{
ffmpeg_InitCodec( p_dec );
- if( !avcodec_is_open( p_context ) )
- OpenVideoCodec( p_dec );
+ if( !avcodec_is_open( p_context ) && OpenVideoCodec(p_dec) < 0 )
+ {
+ if( p_block != NULL )
+ block_Release( p_block );
+ return NULL;
+ }
}
- p_block = pp_block ? *pp_block : NULL;
if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
return NULL;