Commit 359eb52a authored by Tristan Matthews's avatar Tristan Matthews Committed by Jean-Baptiste Kempf

avcodec: Fix dereference after NULL check (cid #1048740)

(cherry picked from commit 4386b8c617c34f79d1b8ec0780e9cffaa9d16ac0)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 44f8b477
......@@ -660,7 +660,8 @@ int OpenEncoder( vlc_object_t *p_this )
/* Try to match avcodec input format to vlc format so we could avoid one
format conversion */
if( GetVlcAudioFormat( p_context->sample_fmt ) != p_enc->fmt_in.i_codec )
if( GetVlcAudioFormat( p_context->sample_fmt ) != p_enc->fmt_in.i_codec
&& p_codec->sample_fmts )
{
msg_Dbg( p_enc, "Trying to find more suitable sample format instead of %s", av_get_sample_fmt_name( p_context->sample_fmt ) );
for( unsigned int i=0; p_codec->sample_fmts[i] != -1; i++ )
......@@ -676,7 +677,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_sys->b_planar = av_sample_fmt_is_planar( p_context->sample_fmt );
// Try if we can use interleaved format for codec input as VLC doesn't really do planar audio yet
// FIXME: Remove when planar/interleaved audio in vlc is equally supported
if( p_sys->b_planar )
if( p_sys->b_planar && p_codec->sample_fmts )
{
msg_Dbg( p_enc, "Trying to find packet sample format instead of planar %s", av_get_sample_fmt_name( p_context->sample_fmt ) );
for( unsigned int i=0; p_codec->sample_fmts[i] != -1; i++ )
......
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