diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-03-12 13:49:56 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-03-12 13:51:56 +0000 |
commit | 7b90bf32150897a141a29a12ecab555d8c5b7fab (patch) | |
tree | da0a110770ac8f45b48cce412a60691e74d68ef1 | |
parent | c809bcd3942ddba72103dbd63d182d8489402820 (diff) |
level: Don't read over the end of the input memory
Previously we advanced the in_data pointer by bps for every channel, and then
later again for block_size*bps. This caused us to be one sample further than
expected if an input buffer covered two analysis frames. And in the end lead
to completely bogus values reported by level.
https://bugzilla.gnome.org/show_bug.cgi?id=746065
-rw-r--r-- | gst/level/gstlevel.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c index 7cd5a8f8d..a308267d6 100644 --- a/gst/level/gstlevel.c +++ b/gst/level/gstlevel.c @@ -624,7 +624,7 @@ gst_level_transform_ip (GstBaseTransform * trans, GstBuffer * in) for (i = 0; i < channels; ++i) { if (!GST_BUFFER_FLAG_IS_SET (in, GST_BUFFER_FLAG_GAP)) { - filter->process (in_data, block_int_size, channels, &CS, + filter->process (in_data + (bps * i), block_int_size, channels, &CS, &filter->peak[i]); GST_LOG_OBJECT (filter, "[%d]: cumulative squares %lf, over %d samples/%d channels", @@ -633,7 +633,6 @@ gst_level_transform_ip (GstBaseTransform * trans, GstBuffer * in) } else { filter->peak[i] = 0.0; } - in_data += bps; filter->decay_peak_age[i] += GST_FRAMES_TO_CLOCK_TIME (num_frames, rate); GST_LOG_OBJECT (filter, |