mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rgvolume: Improve log message for peak values >1.0 by clamping explicitly.
This commit is contained in:
parent
9f3ad53ca8
commit
157531d91e
1 changed files with 15 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue