Check mandatory ClockTime arguments

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/837>
This commit is contained in:
François Laignel 2021-06-16 11:59:20 +02:00
parent b16e96dd87
commit 5230cab38d
10 changed files with 27 additions and 3 deletions

View file

@ -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;

View file

@ -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;

View file

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

View file

@ -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;

View file

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

View file

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

View file

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

View file

@ -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;

View file

@ -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 %"

View file

@ -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;
}
/**