diff options
author | François Laignel <fengalin@free.fr> | 2021-06-16 11:59:20 +0200 |
---|---|---|
committer | François Laignel <fengalin@free.fr> | 2021-06-16 12:33:28 +0200 |
commit | 5230cab38d22b861fec54174c9285fb4c2f10cef (patch) | |
tree | c72ee7d7b38521fb26f927039d0e4742de9c9ef1 /gst | |
parent | b16e96dd878e0c5e7baeb8fad62ca43de1f66982 (diff) |
Check mandatory ClockTime arguments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/837>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstclock.c | 10 | ||||
-rw-r--r-- | gst/gstcontrolbinding.c | 1 | ||||
-rw-r--r-- | gst/gstcontrolsource.c | 3 | ||||
-rw-r--r-- | gst/gstelement.c | 1 | ||||
-rw-r--r-- | gst/gstevent.c | 2 | ||||
-rw-r--r-- | gst/gstmessage.c | 2 |
6 files changed, 19 insertions, 0 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); |