GNOME Bugzilla – Bug 741045
audiorate can can lose timestamp precision in some cases
Last modified: 2014-12-12 16:04:32 UTC
Created attachment 292025 [details] [review] The git diff of the proposed change Description: 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.
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 <crh184@psu.edu> 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. https://bugzilla.gnome.org/show_bug.cgi?id=741045
Cherry-picked into 1.4 branch.