Original commit message from CVS:
* gst-libs/gst/audio/audio.h:
Use gst_util_uint64_scale() instead of doing the math
with double for GST_FRAMES_TO_CLOCK_TIME() and
GST_CLOCK_TIME_TO_FRAMES(). For large timestamps this
prevents rounding errors. Fixes #467667.
+2007-08-17 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst-libs/gst/audio/audio.h:
+ Use gst_util_uint64_scale() instead of doing the math
+ with double for GST_FRAMES_TO_CLOCK_TIME() and
+ GST_CLOCK_TIME_TO_FRAMES(). For large timestamps this
+ prevents rounding errors. Fixes #467667.
+
2007-08-17 Wim Taymans <wim.taymans@gmail.com>
* gst-libs/gst/rtsp/gstrtspconnection.c:
* Calculate clocktime from sample @frames and @rate.
*/
#define GST_FRAMES_TO_CLOCK_TIME(frames, rate) \
- ((GstClockTime) (((gdouble) frames / rate) * GST_SECOND))
+ ((GstClockTime) gst_util_uint64_scale (frames, GST_SECOND, rate))
/**
* GST_CLOCK_TIME_TO_FRAMES:
* Calculate frames from @clocktime and sample @rate.
*/
#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate) \
- ((gint64) ((gst_guint64_to_gdouble (clocktime) / GST_SECOND) * rate))
+ gst_util_uint64_scale (clocktime, rate, GST_SECOND)
/**
* GST_AUDIO_DEF_RATE: