GNOME Bugzilla – Bug 755353
rtsprange: gst_rtsp_range_get_times() returns the wrong value for ntp ranges
Last modified: 2018-11-03 11:41:46 UTC
Created attachment 311758 [details] [review] Unit test with an ntp error case gst_rtsp_range_get_times() returns wrong values for reasonably large numbers for npt. I have attached a unit test, which uses ~40 years expressed in seconds, and the result is that the fractions of a second is lost/rounded.
I see this failure: libs/rtsp.c:299:F:general:test_rtsp_range_npt:0: 'min' (1261440000000000000) is not equal to '1261440000125000000' (1261440000125000000)
Can you provide a patch for fixing this? I see that some floating point numbers are used here, maybe the lower parts get lost because of inaccuracies there?
I tried to solve it like this: +++ b/gst-libs/gst/rtsp/gstrtsprange.c @@ -488,8 +488,8 @@ get_seconds (const GstRTSPTime * t) * errors. * This only works for "small" numbers, because num is limited to 32-bit */ - gst_util_double_to_fraction (t->seconds, &num, &denom); - return gst_util_uint64_scale_int (GST_SECOND, num, denom); + gst_util_double_to_fraction (t->seconds - (GstClockTime)t->seconds, &num, &denom); + return (GstClockTime)t->seconds * GST_SECOND + gst_util_uint64_scale_int (GST_SECOND, num, denom); } else { return gst_util_gdouble_to_guint64 (t->seconds * GST_SECOND); } But, then I got libs/rtsp.c:283:F:general:test_rtsp_range_npt:0: 'max' (78300009999999) is not equal to '78300010000000' (78300010000000)
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/226.