validate:scenario: Round results of expressions in a sensible way

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/207>
This commit is contained in:
Thibault Saunier 2020-06-15 09:32:23 -04:00 committed by GStreamer Merge Bot
parent 19550bec3d
commit 521245fabd

View 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);