After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741045 - audiorate can can lose timestamp precision in some cases
audiorate can can lose timestamp precision in some cases
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.4.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2014-12-02 20:58 UTC by Chad
Modified: 2014-12-12 16:04 UTC
See Also:
GNOME target: ---
GNOME version: ---

The git diff of the proposed change (2.40 KB, patch)
2014-12-02 20:58 UTC, Chad
committed Details | Review

Description Chad 2014-12-02 20:58:46 UTC
Created attachment 292025 [details] [review]
The git diff of the proposed change


The audiorate element uses gst_util_uint64_scale_int() for some time stamp calculations, which truncates (rounds down), instead of gst_util_uint64_scale_int_round(), which will round up when appropriate.  Over time very small time stamp drifts can occur in some circumstances.  For code that requires extremely strict time stamp consistency, this is a problem.  The attached diff simply updates these functions.

Steps to Reproduce:

I confess that the case where I encounter this is in a pipeline with custom elements (doing gravitational-wave data analysis, which demands very precise time stamp bookeeping).  If this change is controversial, I will put the time into coming up with a test case using "stock" elements.  Please let me know.

Actual Results:

Timestamps can drift by approximately 1 ns over time

Expected results:

Exact timestamps that reflect the sample offset and the sample rate

Build Date & Platform:

patch against git checkout on Ubuntu 14.04. First noticed on 0.10.32 on Scientific Linux 6.

The git diff is attached.
Comment 1 Olivier Crête 2014-12-02 21:09:54 UTC
The _round() functions are there exactly for this kind of problem, thank you for your patch.

Next time, please make it into a git commit/patch, this also should run the commit hook which runs gst-indent (and insures the right indentation style is used).

Patch merged:

commit e397b03f3544bffaced6028ac1bfc5d15bc3f214
Author: Chad <>
Date:   Tue Dec 2 15:58:00 2014 -0500

    audiorate: Use gst_util_uint64_scale_int_round()
    Using gst_util_uint64_scale_int() causes slight drift
    which accumulates over time.
Comment 2 Tim-Philipp Müller 2014-12-12 16:04:32 UTC
Cherry-picked into 1.4 branch.