avfilter/af_dynaudnorm: fix another clipping with custom peak value
authorPaul B Mahol <onemda@gmail.com>
Sat, 4 Jan 2020 18:10:06 +0000 (19:10 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sat, 4 Jan 2020 18:34:50 +0000 (19:34 +0100)
This always happened at start with alternative boundary mode disabled.
The clipping only occurred if starting samples where high enough.

libavfilter/af_dynaudnorm.c

index 1330433..27c13bf 100644 (file)
@@ -477,7 +477,7 @@ static void update_gain_history(DynamicAudioNormalizerContext *s, int channel,
     if (cqueue_empty(s->gain_history_original[channel]) ||
         cqueue_empty(s->gain_history_minimum[channel])) {
         const int pre_fill_size = s->filter_size / 2;
-        const double initial_value = s->alt_boundary_mode ? gain.max_gain : 1.0;
+        const double initial_value = s->alt_boundary_mode ? gain.max_gain : s->peak_value;
 
         s->prev_amplification_factor[channel] = initial_value;