validate: scenario: Add a way to set pipeline base-time, start-time and force using the system clock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5803>
This commit is contained in:
Thibault Saunier 2023-12-12 10:42:32 -03:00 committed by GStreamer Marge Bot
parent aad06b091e
commit fbf478b3f5
2 changed files with 48 additions and 0 deletions

View file

@ -58,6 +58,19 @@ configs = {
Note: Since this is GstStructure synthax, we need to have the structures in the
array as strings/within quotes.
## `base-time`
The `base-time` fields lets you set the Pipeline base-time as defined in [gst_element_set_base_time](gst_element_set_base_time).
## `use-system-clock`
The `use-system-clock` fields lets you set force the Pipeline to use the
[`GstSystemClock`](GstSystemClock)
## `start-time`
The `start-time` fields lets you set the Pipeline start-time as defined in [gst_element_set_start_time](gst_element_set_start_time).
## expected-issues
The `expected-issues` field is an array of `expected-issue` structures containing

View file

@ -5924,11 +5924,46 @@ gst_validate_scenario_new (GstValidateRunner *
GST_OBJECT_NAME (pipeline));
g_weak_ref_init (&scenario->priv->ref_pipeline, pipeline);
GstClockTime base_time, start_time;
gboolean use_system_clock = FALSE;
if (gst_validate_utils_get_clocktime (scenario->description, "base-time",
&base_time)) {
gst_validate_printf (NULL,
"**-> Setting %" GST_PTR_FORMAT " base time to %" GST_TIMEP_FORMAT
"**\n", pipeline, &base_time);
gst_element_set_base_time (GST_ELEMENT (pipeline), base_time);
}
if (gst_validate_utils_get_clocktime (scenario->description, "start-time",
&start_time)) {
gst_validate_printf (NULL,
"**-> Setting %" GST_PTR_FORMAT " start time to %" GST_TIMEP_FORMAT
"**\n", pipeline, &base_time);
gst_element_set_start_time (GST_ELEMENT (pipeline), start_time);
}
gst_structure_get_boolean (scenario->description, "use-system-clock",
&use_system_clock);
if (scenario->priv->clock) {
if (use_system_clock)
gst_validate_abort
("Requested to use system clock and test clock at the same time");
gst_element_set_clock (pipeline, GST_CLOCK_CAST (scenario->priv->clock));
gst_pipeline_use_clock (GST_PIPELINE (pipeline),
GST_CLOCK_CAST (scenario->priv->clock));
}
if (use_system_clock) {
GstClock *system_clock = gst_system_clock_obtain ();
gst_element_set_clock (pipeline, system_clock);
gst_pipeline_use_clock (GST_PIPELINE (pipeline), system_clock);
gst_validate_printf (NULL,
"**-> Using clock %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT "**\n",
system_clock, pipeline);
}
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (scenario),
g_filename_display_basename (scenario_name));