Commit 94f1748b authored by Arun Raghavan's avatar Arun Raghavan Committed by Arun Raghavan
Browse files

tinyalsasink: Use glib CLAMP() instead of our own macro

parent 463ea1a9
......@@ -277,12 +277,6 @@ pcm_config_from_spec (struct pcm_config *config,
config->period_count = spec->buffer_time / spec->latency_time;
}
#define LIMIT(i, min, max) \
if ((i) < (min)) \
(i) = (min); \
else if ((i) > (max)) \
(i) = (max);
static gboolean
gst_tinyalsa_sink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
{
......@@ -309,8 +303,9 @@ gst_tinyalsa_sink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
pcm_params_free (params);
/* Snap period size/count to the permitted range */
LIMIT (config.period_size, period_size_min, period_size_max);
LIMIT (config.period_count, periods_min, periods_max);
config.period_size =
CLAMP (config.period_size, period_size_min, period_size_max);
config.period_count = CLAMP (config.period_count, periods_min, periods_max);
/* mutex with getcaps */
GST_OBJECT_LOCK (sink);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment