After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755353 - rtsprange: gst_rtsp_range_get_times() returns the wrong value for ntp ranges
rtsprange: gst_rtsp_range_get_times() returns the wrong value for ntp ranges
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-21 14:04 UTC by Linus Svensson
Modified: 2018-11-03 11:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unit test with an ntp error case (1.39 KB, patch)
2015-09-21 14:04 UTC, Linus Svensson
none Details | Review

Description Linus Svensson 2015-09-21 14:04:09 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.
Comment 1 Linus Svensson 2015-09-21 14:05:24 UTC
I see this failure:
libs/rtsp.c:299:F:general:test_rtsp_range_npt:0: 'min' (1261440000000000000) is not equal to '1261440000125000000' (1261440000125000000)
Comment 2 Sebastian Dröge (slomo) 2015-09-22 10:46:23 UTC
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?
Comment 3 Linus Svensson 2018-05-06 10:46:57 UTC
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)
Comment 4 GStreamer system administrator 2018-11-03 11:41:46 UTC
-- 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.