[vlc-commits] [Git][videolan/vlc][3.0.x] 5 commits: codec: faad: reject ELD profile

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 4 19:35:39 UTC 2022



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
3bfe4f14 by Francois Cartegnie at 2022-11-04T19:16:07+00:00
codec: faad: reject ELD profile

(cherry picked from commit eaedf156a46ad8ac27bc64942892b358f91e4a61)

- - - - -
d906e3e7 by Francois Cartegnie at 2022-11-04T19:16:07+00:00
codec: faad: workaround unaligned timings

(cherry picked from commit c8d7729ae6f3663a5cfde12fb0c185e2a3972461)

- - - - -
2c5a7264 by Lyndon Brown at 2022-11-04T19:16:07+00:00
faad: check config validity

the `NeAACDecSetConfiguration()` function copies attributes from the given
config object to the actual config held within the decoder context object..
it validates each config attribute before copying it, immediately returning
zero if the attribute is invalid.

we should use the return value to check that our config was successfully
written.

(cherry picked from commit 8beee731064750745667cf21b63394c04157dd35)

- - - - -
24ebefda by Francois Cartegnie at 2022-11-04T19:16:07+00:00
codec: faad: always init to TS_INVALID

partial bp of 10318107ac248f2d9b1be038265f3d29a6734c97

- - - - -
6e274f32 by Alexandre Janniaux at 2022-11-04T19:16:07+00:00
faad: remove useless continue statement

... at the end of the loop.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
(cherry picked from commit 603ade4f5d01d03b240694992a596b3c5904148b)

- - - - -


1 changed file:

- modules/codec/faad.c


Changes:

=====================================
modules/codec/faad.c
=====================================
@@ -72,6 +72,7 @@ struct decoder_sys_t
 
     /* samples */
     date_t date;
+    mtime_t i_last_length;
 
     /* temporary buffer */
     block_t *p_block;
@@ -110,7 +111,10 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     NeAACDecConfiguration *cfg;
 
-    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A ||
+        p_dec->fmt_in.i_profile == AAC_PROFILE_ELD ||
+        (p_dec->fmt_in.i_extra > 1 &&
+         (GetWBE(p_dec->fmt_in.p_extra) & 0xffe0) == 0xf8e0)) /* ELD AOT */
     {
         return VLC_EGENERIC;
     }
@@ -128,8 +132,6 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* Misc init */
-    date_Set( &p_sys->date, 0 );
-
     p_dec->fmt_out.audio.channel_type = p_dec->fmt_in.audio.channel_type;
 
     if( p_dec->fmt_in.i_extra > 0 )
@@ -161,6 +163,7 @@ static int Open( vlc_object_t *p_this )
         /* Will be initalised from first frame */
         p_dec->fmt_out.audio.i_rate = 0;
         p_dec->fmt_out.audio.i_channels = 0;
+        date_Set( &p_sys->date, VLC_TS_INVALID );
     }
 
     p_dec->fmt_out.i_codec = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
@@ -171,7 +174,15 @@ static int Open( vlc_object_t *p_this )
     if( p_dec->fmt_in.audio.i_rate )
         cfg->defSampleRate = p_dec->fmt_in.audio.i_rate;
     cfg->outputFormat = HAVE_FPU ? FAAD_FMT_FLOAT : FAAD_FMT_16BIT;
-    NeAACDecSetConfiguration( p_sys->hfaad, cfg );
+    if( !NeAACDecSetConfiguration( p_sys->hfaad, cfg ) )
+    {
+        msg_Err( p_dec, "Failed to set faad configuration" );
+        NeAACDecClose( p_sys->hfaad );
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
+
+    p_sys->i_last_length = 0;
 
     /* buffer */
     p_sys->p_block = NULL;
@@ -320,9 +331,12 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
 
     if( i_pts > VLC_TS_INVALID && i_pts != date_Get( &p_sys->date ) )
     {
-        date_Set( &p_sys->date, i_pts );
+        if( p_sys->i_last_length == 0 ||
+            /* We need to be permissive and rebase dts when it's really way off */
+            llabs( i_pts - date_Get( &p_sys->date ) ) > p_sys->i_last_length * 3 / 2  )
+            date_Set( &p_sys->date, i_pts );
     }
-    else if( !date_Get( &p_sys->date ) )
+    else if( date_Get( &p_sys->date ) == VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         FlushBuffer( p_sys, SIZE_MAX );
@@ -557,7 +571,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
             p_out->i_length = date_Increment( &p_sys->date,
                                               frame.samples / frame.channels )
                               - p_out->i_pts;
-
+            p_sys->i_last_length = p_out->i_length;
             if ( p_dec->fmt_out.audio.channel_type == AUDIO_CHANNEL_TYPE_BITMAP )
             {
                 /* Don't kill speakers if some weird mapping does not gets 1:1 */
@@ -593,8 +607,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
             /* Drop byte of padding */
             FlushBuffer( p_sys, 0 );
         }
-
-        continue;
     }
 
     return VLCDEC_SUCCESS;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ee3213605d176c0a884b1d93dff7fc48b8848400...6e274f32227dde52565e0924ceb4773f296ad2ba

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ee3213605d176c0a884b1d93dff7fc48b8848400...6e274f32227dde52565e0924ceb4773f296ad2ba
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list