[vlc-commits] [Git][videolan/vlc][master] 2 commits: faad: don't use a 0 sampling frequency
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Sep 3 13:14:53 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e7518df1 by Steve Lhomme at 2026-09-03T12:57:37+00:00
faad: don't use a 0 sampling frequency
It can happen if the SBR frequency is not understood (#29894).
- - - - -
74ac52aa by Steve Lhomme at 2026-09-03T12:57:37+00:00
faad: Do not call NeAACDecInit2() if it's going to given 0 sampling frequency
NeAACDecInit2() returns an error when the sampling frequency is 0, unless it's
an SBR stream. The (successful) call to NeAACDecInit() with the actual data
will work but SBR won't be used.
If NeAACDecAudioSpecificConfig() fails, NeAACDecInit2() will fail too, so no need
to do it as it allocates a lot of memory.
NeAACDecAudioSpecificConfig() is available since faad 2.8.0 in 2007 [^1].
Fixes #29894
[^1]: https://github.com/knik0/faad2/commit/5cfc298514b652c1fa3753f7fd7fb7bd70da05a1
- - - - -
1 changed file:
- modules/codec/faad.c
Changes:
=====================================
modules/codec/faad.c
=====================================
@@ -145,13 +145,18 @@ static int Open( vlc_object_t *p_this )
if( p_dec->fmt_in->i_extra > 0 )
{
/* We have a decoder config so init the handle */
- unsigned long i_rate;
+ unsigned long i_rate = 0;
unsigned char i_channels;
- if( NeAACDecInit2( p_sys->hfaad, p_dec->fmt_in->p_extra,
- p_dec->fmt_in->i_extra,
- &i_rate, &i_channels ) < 0 ||
- i_channels >= MPEG4_ASC_MAX_INDEXEDPOS )
+ mp4AudioSpecificConfig mp4Conf;
+ if( NeAACDecAudioSpecificConfig( p_dec->fmt_in->p_extra,
+ p_dec->fmt_in->i_extra,
+ &mp4Conf ) >= 0 &&
+ mp4Conf.samplingFrequency != 0 &&
+ ( NeAACDecInit2( p_sys->hfaad, p_dec->fmt_in->p_extra,
+ p_dec->fmt_in->i_extra,
+ &i_rate, &i_channels ) < 0 ||
+ i_channels >= MPEG4_ASC_MAX_INDEXEDPOS ) )
{
msg_Err( p_dec, "Failed to initialize faad using extra data" );
NeAACDecClose( p_sys->hfaad );
@@ -159,11 +164,14 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- p_dec->fmt_out.audio.i_rate = i_rate;
- p_dec->fmt_out.audio.i_channels = i_channels;
- p_dec->fmt_out.audio.i_physical_channels
- = MPEG4_asc_channelsbyindex[i_channels];
- date_Init( &p_sys->date, i_rate, 1 );
+ if( i_rate != 0 )
+ {
+ p_dec->fmt_out.audio.i_rate = i_rate;
+ p_dec->fmt_out.audio.i_channels = i_channels;
+ p_dec->fmt_out.audio.i_physical_channels
+ = MPEG4_asc_channelsbyindex[i_channels];
+ date_Init( &p_sys->date, i_rate, 1 );
+ }
}
else
{
@@ -300,11 +308,16 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
{
unsigned long i_rate = 0;
unsigned char i_channels;
+ mp4AudioSpecificConfig mp4Conf;
/* Init from DecoderConfig */
if( p_dec->fmt_in->i_extra > 0 &&
- NeAACDecInit2( p_sys->hfaad, p_dec->fmt_in->p_extra,
- p_dec->fmt_in->i_extra, &i_rate, &i_channels ) != 0 )
+ ( NeAACDecAudioSpecificConfig( p_dec->fmt_in->p_extra,
+ p_dec->fmt_in->i_extra,
+ &mp4Conf ) < 0 ||
+ mp4Conf.samplingFrequency == 0 ||
+ NeAACDecInit2( p_sys->hfaad, p_dec->fmt_in->p_extra,
+ p_dec->fmt_in->i_extra, &i_rate, &i_channels ) != 0 ) )
{
/* Failed, will try from data */
i_rate = 0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b5eca8bb77803eb81d5ac3c895e67f358e55f20...74ac52aaf6e964ac402e48b91a5818c027be5bc1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b5eca8bb77803eb81d5ac3c895e67f358e55f20...74ac52aaf6e964ac402e48b91a5818c027be5bc1
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list