summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-10-31 22:29:24 (GMT)
committerStefan Kost <ensonic@users.sf.net>2009-10-31 22:31:48 (GMT)
commit71044b37b66b309716267d48f6a7ae343558914e (patch)
treebcac5a66e7e0fdb60553dc5e60bc1e71ea2823a1
parentf5b3392fa6c36cfe88a489f7b54ec8e4e9e9c1d4 (diff)
level: calculate the message-intervall when it changes
-rw-r--r--gst/level/gstlevel.c10
-rw-r--r--gst/level/gstlevel.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c
index 0d93428..b8b99dc 100644
--- a/gst/level/gstlevel.c
+++ b/gst/level/gstlevel.c
@@ -281,6 +281,10 @@ gst_level_set_property (GObject * object, guint prop_id,
break;
case PROP_SIGNAL_INTERVAL:
filter->interval = g_value_get_uint64 (value);
+ if (filter->rate) {
+ filter->interval_frames =
+ GST_CLOCK_TIME_TO_FRAMES (filter->interval, filter->rate);
+ }
break;
case PROP_PEAK_TTL:
filter->decay_peak_ttl =
@@ -483,6 +487,9 @@ gst_level_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
filter->decay_peak_age[i] = G_GUINT64_CONSTANT (0);
}
+ filter->interval_frames =
+ GST_CLOCK_TIME_TO_FRAMES (filter->interval, filter->rate);
+
return TRUE;
}
@@ -648,8 +655,7 @@ gst_level_transform_ip (GstBaseTransform * trans, GstBuffer * in)
filter->num_frames += num_frames;
/* do we need to message ? */
- if (filter->num_frames >=
- GST_CLOCK_TIME_TO_FRAMES (filter->interval, filter->rate)) {
+ if (filter->num_frames >= filter->interval_frames) {
if (filter->message) {
GstMessage *m;
GstClockTime duration =
diff --git a/gst/level/gstlevel.h b/gst/level/gstlevel.h
index d8c06a2..32d4c9e 100644
--- a/gst/level/gstlevel.h
+++ b/gst/level/gstlevel.h
@@ -67,6 +67,7 @@ struct _GstLevel {
gdouble decay_peak_falloff; /* falloff in dB/sec */
gint num_frames; /* frame count (1 sample per channel)
* since last emit */
+ gint interval_frames; /* after how many frame to sent a message */
GstClockTime message_ts; /* starttime for next message */
/* per-channel arrays for intermediate values */