[vlc-commits] [Git][videolan/vlc][master] 2 commits: codec: avcodec: return error for realloc failure
Steve Lhomme
gitlab at videolan.org
Fri Jun 25 11:06:28 UTC 2021
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
7cd7b322 by Zhao Zhili at 2021-06-25T10:53:12+00:00
codec: avcodec: return error for realloc failure
- - - - -
21ab6be2 by Zhao Zhili at 2021-06-25T10:53:12+00:00
codec: avcodec: check open codec return value
- - - - -
2 changed files:
- modules/codec/avcodec/audio.c
- modules/codec/avcodec/video.c
Changes:
=====================================
modules/codec/avcodec/audio.c
=====================================
@@ -305,7 +305,12 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
&& !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 ) )
=====================================
modules/codec/avcodec/video.c
=====================================
@@ -900,16 +900,19 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
bool b_need_output_picture = true;
bool b_error = false;
- block_t *p_block;
+ block_t *p_block = pp_block ? *pp_block : NULL;
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 VLCDEC_ECRITICAL;
+ }
}
- p_block = pp_block ? *pp_block : NULL;
if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
return VLCDEC_SUCCESS;
@@ -953,7 +956,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = block_Realloc( p_block, 0,
p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE );
if( !p_block )
- return VLCDEC_SUCCESS;
+ return VLCDEC_ECRITICAL;
p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
*pp_block = p_block;
memset( p_block->p_buffer + p_block->i_buffer, 0,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e54daddeaa86308beb43078d18b6c5c6db08c76b...21ab6be22e7c1831cebf023fd53bd7ffbfad22f6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e54daddeaa86308beb43078d18b6c5c6db08c76b...21ab6be22e7c1831cebf023fd53bd7ffbfad22f6
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list