rgvolume: Improve log message for peak values >1.0 by clamping explicitly.

This commit is contained in:
René Stadler 2009-02-28 15:26:00 +02:00
parent 9f3ad53ca8
commit 157531d91e

View file

@ -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;