Commit 846ddaa5 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

gst-libs/gst/audio/audio.h: Use gst_util_uint64_scale() instead of doing the...

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.
parent 01d9553d
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:
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment