Skip to content

Commit

Permalink
Check mandatory ClockTime arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fengalin authored and GStreamer Marge Bot committed Jun 16, 2021
1 parent 885c1c6 commit 973f0bf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gst-libs/gst/audio/gstaudiobasesink.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions gst-libs/gst/audio/gstaudiodecoder.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions gst-libs/gst/audio/gstaudioencoder.c
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions gst-libs/gst/audio/gstaudiostreamalign.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions gst-libs/gst/pbutils/gstdiscoverer.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 973f0bf

Please sign in to comment.