From 521245fabd8e8284e348515896d7bb1c846c9d62 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 15 Jun 2020 09:32:23 -0400 Subject: [PATCH] validate:scenario: Round results of expressions in a sensible way Part-of: --- validate/gst/validate/gst-validate-scenario.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 5bdc8d31c5..de1d052641 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -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);