GNOME Bugzilla – Bug 567955
[spectrum] Need compensation for rounding errors
Last modified: 2009-01-23 08:37:41 UTC
Hi, we need some compensation for rounding errors in the spectrum element at several places: a) The number of samples per interval is rounded down ( interval * GST_SECOND / rate ) which results in more spectrum messages over time than requested b) The timestamps of the messages are calculated from the first buffer timestamp + n * interval. Because of a) this results in timestamps lacking behind the real stream time.
I've implemented this now by adding a counter for the accumulated error and adding an additional sample to every interval when it overflows (i.e. >= GST_SECOND). 2009-01-19 Sebastian Dröge <sebastian.droege@collabora.co.uk> * gst/spectrum/gstspectrum.c: (gst_spectrum_reset_state), (gst_spectrum_transform_ip): * gst/spectrum/gstspectrum.h: Implement a simple compensation algorithm for rounding errors. This makes sure that a spectrum message is posted on the bus every interval nanoseconds. Fixes bug #567955.