mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
rganalysis: fix timestamp rounding
Use scaling function to round and avoid overflows. Fixes #604352
This commit is contained in:
parent
908a9ee63b
commit
7b107f64f3
1 changed files with 5 additions and 3 deletions
|
@ -710,9 +710,11 @@ rg_analysis_analyze (RgAnalysisCtx * ctx, const gfloat * samples_l,
|
||||||
(gint) G_N_ELEMENTS (ctx->track.histogram) - 1);
|
(gint) G_N_ELEMENTS (ctx->track.histogram) - 1);
|
||||||
/* Compute the per-window gain */
|
/* Compute the per-window gain */
|
||||||
const gdouble gain = PINK_REF - (gdouble) ival / STEPS_PER_DB;
|
const gdouble gain = PINK_REF - (gdouble) ival / STEPS_PER_DB;
|
||||||
const GstClockTime timestamp = (ctx->buffer_timestamp
|
const GstClockTime timestamp = ctx->buffer_timestamp
|
||||||
+ ctx->buffer_n_samples_done * GST_SECOND / ctx->sample_rate
|
+ gst_util_uint64_scale_int_ceil (GST_SECOND,
|
||||||
- RMS_WINDOW_MSECS * GST_MSECOND);
|
ctx->buffer_n_samples_done,
|
||||||
|
ctx->sample_rate)
|
||||||
|
- RMS_WINDOW_MSECS * GST_MSECOND;
|
||||||
|
|
||||||
ctx->post_message (ctx->analysis, timestamp,
|
ctx->post_message (ctx->analysis, timestamp,
|
||||||
RMS_WINDOW_MSECS * GST_MSECOND, -gain);
|
RMS_WINDOW_MSECS * GST_MSECOND, -gain);
|
||||||
|
|
Loading…
Reference in a new issue