[gstreamer-bugs] [Bug 590919] New: gst_util_uint64_scale_int() and friends don't round

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Thu Aug 6 02:14:52 PDT 2009


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=590919

  GStreamer | gstreamer (core) | Ver: git
           Summary: gst_util_uint64_scale_int() and friends don't round
           Product: GStreamer
           Version: git
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: kcannon at ligo.caltech.edu
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


The utility functions gst_util_uint64_scale() and gst_util_uint64_scale_int()
truncate their results instead of rounding.  This causes drifts in timestamps
in pipelines that use these functions to convert repeatedly between offsets and
timestamp (which can be needed in elements that preserve internal state, etc.).

The problems this creates are most visible when the sample rate in a stream is
such that times of individual samples don't correspond to integer counts of
nanoseconds.  For example, power-of-two sample rates like 16384 Hz have this
problem becuase 16384^-1 cannot be represented exactly by an integer count of
nanoseconds.

The behaviour of the scale-by-ratio functions can be switched to produce
rounded results by simply adding 1/2 of the denominator to the numerator
product before entering the division stages in the various algorithms.


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=590919.




More information about the Gstreamer-bugs mailing list