Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gstreamer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Laignel <fengalin@free.fr>2021-06-16 12:59:20 +0300
committerFrançois Laignel <fengalin@free.fr>2021-06-16 13:33:28 +0300
commit5230cab38d22b861fec54174c9285fb4c2f10cef (patch)
treec72ee7d7b38521fb26f927039d0e4742de9c9ef1
parentb16e96dd878e0c5e7baeb8fad62ca43de1f66982 (diff)
Check mandatory ClockTime arguments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/837>
-rw-r--r--gst/gstclock.c10
-rw-r--r--gst/gstcontrolbinding.c1
-rw-r--r--gst/gstcontrolsource.c3
-rw-r--r--gst/gstelement.c1
-rw-r--r--gst/gstevent.c2
-rw-r--r--gst/gstmessage.c2
-rw-r--r--libs/gst/base/gstbaseparse.c4
-rw-r--r--libs/gst/base/gstbasesink.c1
-rw-r--r--libs/gst/base/gstbasetransform.c1
-rw-r--r--libs/gst/check/gstharness.c5
10 files changed, 27 insertions, 3 deletions
diff --git a/gst/gstclock.c b/gst/gstclock.c
index 11a02900a2..9a83cc97f4 100644
--- a/gst/gstclock.c
+++ b/gst/gstclock.c
@@ -310,6 +310,8 @@ gboolean
gst_clock_single_shot_id_reinit (GstClock * clock, GstClockID id,
GstClockTime time)
{
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (time), FALSE);
+
return gst_clock_entry_reinit (clock, (GstClockEntry *) id, time,
GST_CLOCK_TIME_NONE, GST_CLOCK_ENTRY_SINGLE);
}
@@ -331,6 +333,9 @@ gboolean
gst_clock_periodic_id_reinit (GstClock * clock, GstClockID id,
GstClockTime start_time, GstClockTime interval)
{
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (start_time), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
+
return gst_clock_entry_reinit (clock, (GstClockEntry *) id, start_time,
interval, GST_CLOCK_ENTRY_PERIODIC);
}
@@ -412,6 +417,7 @@ GstClockID
gst_clock_new_single_shot_id (GstClock * clock, GstClockTime time)
{
g_return_val_if_fail (GST_IS_CLOCK (clock), NULL);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (time), NULL);
return gst_clock_entry_new (clock,
time, GST_CLOCK_TIME_NONE, GST_CLOCK_ENTRY_SINGLE);
@@ -1147,6 +1153,8 @@ gst_clock_set_calibration (GstClock * clock, GstClockTime internal, GstClockTime
GstClockPrivate *priv;
g_return_if_fail (GST_IS_CLOCK (clock));
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (internal));
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (external));
g_return_if_fail (rate_num != GST_CLOCK_TIME_NONE);
g_return_if_fail (rate_denom > 0 && rate_denom != GST_CLOCK_TIME_NONE);
@@ -1474,6 +1482,8 @@ gst_clock_add_observation_unapplied (GstClock * clock, GstClockTime slave,
guint n;
g_return_val_if_fail (GST_IS_CLOCK (clock), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (slave), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (master), FALSE);
g_return_val_if_fail (r_squared != NULL, FALSE);
priv = clock->priv;
diff --git a/gst/gstcontrolbinding.c b/gst/gstcontrolbinding.c
index 83caa5138e..42c32f1065 100644
--- a/gst/gstcontrolbinding.c
+++ b/gst/gstcontrolbinding.c
@@ -260,6 +260,7 @@ gst_control_binding_sync_values (GstControlBinding * binding,
gboolean ret = FALSE;
g_return_val_if_fail (GST_IS_CONTROL_BINDING (binding), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
if (binding->disabled)
return TRUE;
diff --git a/gst/gstcontrolsource.c b/gst/gstcontrolsource.c
index 1817edce96..04271be0f8 100644
--- a/gst/gstcontrolsource.c
+++ b/gst/gstcontrolsource.c
@@ -84,6 +84,7 @@ gst_control_source_get_value (GstControlSource * self, GstClockTime timestamp,
gdouble * value)
{
g_return_val_if_fail (GST_IS_CONTROL_SOURCE (self), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
if (G_LIKELY (self->get_value)) {
return self->get_value (self, timestamp, value);
@@ -112,6 +113,8 @@ gst_control_source_get_value_array (GstControlSource * self,
gdouble * values)
{
g_return_val_if_fail (GST_IS_CONTROL_SOURCE (self), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE);
if (G_LIKELY (self->get_value_array)) {
return self->get_value_array (self, timestamp, interval, n_values, values);
diff --git a/gst/gstelement.c b/gst/gstelement.c
index 48e41823b5..82244a8aab 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -488,6 +488,7 @@ gst_element_set_base_time (GstElement * element, GstClockTime time)
GstClockTime old;
g_return_if_fail (GST_IS_ELEMENT (element));
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (time));
GST_OBJECT_LOCK (element);
old = element->base_time;
diff --git a/gst/gstevent.c b/gst/gstevent.c
index 036c4f4065..9ace25a7bd 100644
--- a/gst/gstevent.c
+++ b/gst/gstevent.c
@@ -1518,6 +1518,8 @@ gst_event_new_latency (GstClockTime latency)
GstEvent *event;
GstStructure *structure;
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (latency), NULL);
+
GST_CAT_INFO (GST_CAT_EVENT,
"creating latency event %" GST_TIME_FORMAT, GST_TIME_ARGS (latency));
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 26cf379a99..f3f200709e 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -2354,6 +2354,8 @@ gst_message_new_reset_time (GstObject * src, GstClockTime running_time)
GstMessage *message;
GstStructure *structure;
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (running_time), NULL);
+
structure = gst_structure_new_id (GST_QUARK (MESSAGE_RESET_TIME),
GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time, NULL);
message = gst_message_new_custom (GST_MESSAGE_RESET_TIME, src, structure);
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index f1f34798b9..b08a284906 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -1994,6 +1994,8 @@ gst_base_parse_add_index_entry (GstBaseParse * parse, guint64 offset,
gboolean ret = FALSE;
GstIndexAssociation associations[2];
+ g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (ts), FALSE);
+
GST_LOG_OBJECT (parse, "Adding key=%d index entry %" GST_TIME_FORMAT
" @ offset 0x%08" G_GINT64_MODIFIER "x", key, GST_TIME_ARGS (ts), offset);
@@ -4076,7 +4078,7 @@ void
gst_base_parse_set_latency (GstBaseParse * parse, GstClockTime min_latency,
GstClockTime max_latency)
{
- g_return_if_fail (min_latency != GST_CLOCK_TIME_NONE);
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min_latency));
g_return_if_fail (min_latency <= max_latency);
GST_OBJECT_LOCK (parse);
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
index b5b5f13076..c94bbacf5b 100644
--- a/libs/gst/base/gstbasesink.c
+++ b/libs/gst/base/gstbasesink.c
@@ -1327,6 +1327,7 @@ gst_base_sink_set_render_delay (GstBaseSink * sink, GstClockTime delay)
GstClockTime old_render_delay;
g_return_if_fail (GST_IS_BASE_SINK (sink));
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (delay));
GST_OBJECT_LOCK (sink);
old_render_delay = sink->priv->render_delay;
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index f963046745..e4e7ee6415 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -2696,6 +2696,7 @@ gst_base_transform_update_qos (GstBaseTransform * trans,
gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp)
{
g_return_if_fail (GST_IS_BASE_TRANSFORM (trans));
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp));
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, trans,
"qos: proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %"
diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c
index 7d4b2605f5..fc1ab0dafe 100644
--- a/libs/gst/check/gstharness.c
+++ b/libs/gst/check/gstharness.c
@@ -2226,8 +2226,9 @@ gst_harness_query_latency (GstHarness * h)
void
gst_harness_set_upstream_latency (GstHarness * h, GstClockTime latency)
{
- GstHarnessPrivate *priv = h->priv;
- priv->latency_min = latency;
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (latency));
+
+ h->priv->latency_min = latency;
}
/**