gst-libs/gst/audio/audio.h: Use gst_util_uint64_scale() instead of doing the math with double for GST_FRAMES_TO_CLOCK...

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.
This commit is contained in:
Sebastian Dröge 2007-08-17 15:24:43 +00:00
parent 01d9553d43
commit 846ddaa550
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,11 @@
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:

View file

@ -58,7 +58,7 @@ G_BEGIN_DECLS
* 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:
@ -68,7 +68,7 @@ G_BEGIN_DECLS
* 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: