summaryrefslogtreecommitdiffstats
path: root/gst/replaygain
diff options
context:
space:
mode:
authorRené Stadler <mail@renestadler.de>2009-02-28 15:26:00 +0200
committerRené Stadler <mail@renestadler.de>2009-02-28 15:26:00 +0200
commit157531d91e9c5fbff33c4357beba5af31623f35c (patch)
treea416c3ea77a647d9ce3ab75d82067a96f83799e6 /gst/replaygain
parent9f3ad53ca868ce4e33efac104d77391a3a0cf57b (diff)
rgvolume: Improve log message for peak values >1.0 by clamping explicitly.
Diffstat (limited to 'gst/replaygain')
-rw-r--r--gst/replaygain/gstrgvolume.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gst/replaygain/gstrgvolume.c b/gst/replaygain/gstrgvolume.c
index d569b4bb..cf5a914a 100644
--- a/gst/replaygain/gstrgvolume.c
+++ b/gst/replaygain/gstrgvolume.c
@@ -92,7 +92,7 @@ enum
#define PEAK_FORMAT ".06f"
#define VALID_GAIN(x) ((x) > -60.00 && (x) < 60.00)
-#define VALID_PEAK(x) ((x) > 0. && (x) < 1.)
+#define VALID_PEAK(x) ((x) > 0.)
/* Same template caps as GstVolume, for I don't like having just ANY caps. */
@@ -563,6 +563,20 @@ gst_rg_volume_tag_event (GstRgVolume * self, GstEvent * event)
has_album_peak = FALSE;
}
+ /* Clamp peaks >1.0. Float based decoders can produce spurious samples >1.0,
+ * cutting these files back to 1.0 should not cause any audible distortion.
+ * This is most often seen with Vorbis files. */
+ if (has_track_peak && self->track_peak > 1.) {
+ GST_DEBUG_OBJECT (self,
+ "clamping track peak %" PEAK_FORMAT " to 1.0", self->track_peak);
+ self->track_peak = 1.0;
+ }
+ if (has_album_peak && self->album_peak > 1.) {
+ GST_DEBUG_OBJECT (self,
+ "clamping album peak %" PEAK_FORMAT " to 1.0", self->album_peak);
+ self->album_peak = 1.0;
+ }
+
self->has_track_gain |= has_track_gain;
self->has_track_peak |= has_track_peak;
self->has_album_gain |= has_album_gain;