validate:scenario: Round results of expressions in a sensible way
authorThibault Saunier <tsaunier@igalia.com>
Mon, 15 Jun 2020 13:32:23 +0000 (09:32 -0400)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 22 Jun 2020 17:20:32 +0000 (17:20 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/207>

validate/gst/validate/gst-validate-scenario.c

index 5bdc8d3..de1d052 100644 (file)
@@ -848,7 +848,10 @@ gst_validate_action_get_clocktime (GstValidateScenario * scenario,
     } else if (val == -1.0) {
       *retval = GST_CLOCK_TIME_NONE;
     } else {
-      *retval = val * GST_SECOND;
+      gint n, d;
+
+      gst_util_double_to_fraction (val, &n, &d);
+      *retval = gst_util_uint64_scale_int_round (n, GST_SECOND, d);
     }
     gst_structure_set (action->structure, name, G_TYPE_UINT64, *retval, NULL);
     g_free (strval);