[vlc-commits] [Git][videolan/vlc][master] normvol: avoid division by 0

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 17 13:02:48 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
501f041f by Tristan Matthews at 2026-09-17T12:43:55+00:00
normvol: avoid division by 0

The clamp already existed in Open, this just makes it consistent.

Fixes CID 1665547

- - - - -


1 changed file:

- modules/audio_filter/normvol.c


Changes:

=====================================
modules/audio_filter/normvol.c
=====================================
@@ -43,6 +43,8 @@
 #include <vlc_aout.h>
 #include <vlc_filter.h>
 
+#define MIN_FMAX 0.01f
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -104,7 +106,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->f_max = var_CreateGetFloat( vlc_object_parent(p_filter),
                                        "norm-max-level" );
 
-    if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01;
+    if( p_sys->f_max <= 0 ) p_sys->f_max = MIN_FMAX;
 
     /* We need to store (nb_buffers+1)*nb_channels floats */
     p_sys->p_last = calloc( i_channels * (p_sys->i_nb + 2), sizeof(float) );
@@ -190,6 +192,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
         /* Seuil arbitraire */
         p_sys->f_max = var_GetFloat( vlc_object_parent(p_filter),
                                      "norm-max-level" );
+        if( p_sys->f_max <= 0 ) p_sys->f_max = MIN_FMAX;
 
         //fprintf(stderr,"Average %f, max %f\n", f_average, p_sys->f_max );
         if( f_average > p_sys->f_max )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/501f041f1a5f5056fc4c3e35bb836e2d84ac23ca

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/501f041f1a5f5056fc4c3e35bb836e2d84ac23ca
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