Commit 7b107f64 authored by Branko Čibej's avatar Branko Čibej Committed by Wim Taymans

rganalysis: fix timestamp rounding

Use scaling function to round and avoid overflows.

Fixes #604352
parent 908a9ee6
......@@ -710,9 +710,11 @@ rg_analysis_analyze (RgAnalysisCtx * ctx, const gfloat * samples_l,
(gint) G_N_ELEMENTS (ctx->track.histogram) - 1);
/* Compute the per-window gain */
const gdouble gain = PINK_REF - (gdouble) ival / STEPS_PER_DB;
const GstClockTime timestamp = (ctx->buffer_timestamp
+ ctx->buffer_n_samples_done * GST_SECOND / ctx->sample_rate
- RMS_WINDOW_MSECS * GST_MSECOND);
const GstClockTime timestamp = ctx->buffer_timestamp
+ gst_util_uint64_scale_int_ceil (GST_SECOND,
ctx->buffer_n_samples_done,
ctx->sample_rate)
- RMS_WINDOW_MSECS * GST_MSECOND;
ctx->post_message (ctx->analysis, timestamp,
RMS_WINDOW_MSECS * GST_MSECOND, -gain);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment