From 973f0bf55212d5df14943fa230b2427a99e65444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Wed, 16 Jun 2021 12:13:21 +0200 Subject: [PATCH] Check mandatory ClockTime arguments Part-of: --- gst-libs/gst/audio/gstaudiobasesink.c | 2 ++ gst-libs/gst/audio/gstaudiodecoder.c | 2 ++ gst-libs/gst/audio/gstaudioencoder.c | 1 + gst-libs/gst/audio/gstaudiostreamalign.c | 4 ++++ gst-libs/gst/pbutils/gstdiscoverer.c | 4 ++++ 5 files changed, 13 insertions(+) diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c index 359b1b0110..8dba7b964b 100644 --- a/gst-libs/gst/audio/gstaudiobasesink.c +++ b/gst-libs/gst/audio/gstaudiobasesink.c @@ -685,6 +685,7 @@ gst_audio_base_sink_set_alignment_threshold (GstAudioBaseSink * sink, GstClockTime alignment_threshold) { g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (alignment_threshold)); GST_OBJECT_LOCK (sink); sink->priv->alignment_threshold = alignment_threshold; @@ -725,6 +726,7 @@ gst_audio_base_sink_set_discont_wait (GstAudioBaseSink * sink, GstClockTime discont_wait) { g_return_if_fail (GST_IS_AUDIO_BASE_SINK (sink)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (discont_wait)); GST_OBJECT_LOCK (sink); sink->priv->discont_wait = discont_wait; diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 96184aefa8..ec15d6c53e 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -3533,6 +3533,7 @@ void gst_audio_decoder_set_min_latency (GstAudioDecoder * dec, GstClockTime num) { g_return_if_fail (GST_IS_AUDIO_DECODER (dec)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (num)); GST_OBJECT_LOCK (dec); dec->priv->latency = num; @@ -3576,6 +3577,7 @@ void gst_audio_decoder_set_tolerance (GstAudioDecoder * dec, GstClockTime tolerance) { g_return_if_fail (GST_IS_AUDIO_DECODER (dec)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (tolerance)); GST_OBJECT_LOCK (dec); dec->priv->tolerance = tolerance; diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c index 4a14d0c482..60cc6af703 100644 --- a/gst-libs/gst/audio/gstaudioencoder.c +++ b/gst-libs/gst/audio/gstaudioencoder.c @@ -2544,6 +2544,7 @@ void gst_audio_encoder_set_tolerance (GstAudioEncoder * enc, GstClockTime tolerance) { g_return_if_fail (GST_IS_AUDIO_ENCODER (enc)); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (tolerance)); GST_OBJECT_LOCK (enc); enc->priv->tolerance = tolerance; diff --git a/gst-libs/gst/audio/gstaudiostreamalign.c b/gst-libs/gst/audio/gstaudiostreamalign.c index ec4233d4ee..caabc842ed 100644 --- a/gst-libs/gst/audio/gstaudiostreamalign.c +++ b/gst-libs/gst/audio/gstaudiostreamalign.c @@ -86,6 +86,8 @@ gst_audio_stream_align_new (gint rate, GstClockTime alignment_threshold, GstAudioStreamAlign *align; g_return_val_if_fail (rate != 0, NULL); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (alignment_threshold), NULL); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (discont_wait), NULL); align = g_new0 (GstAudioStreamAlign, 1); align->rate = rate; @@ -193,6 +195,7 @@ gst_audio_stream_align_set_alignment_threshold (GstAudioStreamAlign * align, GstClockTime alignment_threshold) { g_return_if_fail (align != NULL); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (alignment_threshold)); align->alignment_threshold = alignment_threshold; } @@ -230,6 +233,7 @@ gst_audio_stream_align_set_discont_wait (GstAudioStreamAlign * align, GstClockTime discont_wait) { g_return_if_fail (align != NULL); + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (discont_wait)); align->discont_wait = discont_wait; } diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 60e54127bb..6d175316cb 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -521,6 +521,8 @@ gst_discoverer_get_property (GObject * object, guint prop_id, static void gst_discoverer_set_timeout (GstDiscoverer * dc, GstClockTime timeout) { + g_return_if_fail (GST_CLOCK_TIME_IS_VALID (timeout)); + GST_DEBUG_OBJECT (dc, "timeout : %" GST_TIME_FORMAT, GST_TIME_ARGS (timeout)); /* FIXME : update current pending timeout if we're running */ @@ -2631,6 +2633,8 @@ gst_discoverer_new (GstClockTime timeout, GError ** err) { GstDiscoverer *res; + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timeout), NULL); + res = g_object_new (GST_TYPE_DISCOVERER, "timeout", timeout, NULL); if (res->priv->uridecodebin == NULL) { if (err)