summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2008-12-04 21:11:17 -0500
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:48:07 +0100
commit6b42ee6ae130872cd947d558b4f83140a19ff0ba (patch)
tree18a647b1acc512decb136cf5c06b9103c1e23696 /gst
parent1468b2e2b061ad1924f51e3630b99623e38b44b9 (diff)
downloadgst-plugins-bad-6b42ee6ae130872cd947d558b4f83140a19ff0ba.tar.gz
gst-plugins-bad-6b42ee6ae130872cd947d558b4f83140a19ff0ba.tar.bz2
gst-plugins-bad-6b42ee6ae130872cd947d558b4f83140a19ff0ba.zip
[MOVED FROM GST-P-FARSIGHT] Improve the minimum quanta to make it impossible for the duration to fall down to 0
Diffstat (limited to 'gst')
-rw-r--r--gst/dtmf/gstrtpdtmfdepay.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gst/dtmf/gstrtpdtmfdepay.c b/gst/dtmf/gstrtpdtmfdepay.c
index 8e82865a..85dac6fe 100644
--- a/gst/dtmf/gstrtpdtmfdepay.c
+++ b/gst/dtmf/gstrtpdtmfdepay.c
@@ -371,8 +371,19 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* clip to whole units of unit_time */
if (rtpdtmfdepay->unit_time)
- dtmf_payload.duration -= dtmf_payload.duration %
- ((rtpdtmfdepay->unit_time * depayload->clock_rate) / 1000);
+ {
+ guint unit_time_clock =
+ (rtpdtmfdepay->unit_time * depayload->clock_rate) / 1000;
+ if (dtmf_payload.duration % unit_time_clock)
+ {
+ /* Make sure we don't overflow the duration */
+ if (dtmf_payload.duration < G_MAXUINT16 - unit_time_clock)
+ dtmf_payload.duration += unit_time_clock -
+ (dtmf_payload.duration % unit_time_clock);
+ else
+ dtmf_payload.duration -= dtmf_payload.duration % unit_time_clock;
+ }
+ }
GST_DEBUG_OBJECT (depayload, "Received new RTP DTMF packet : "
"marker=%d - timestamp=%u - event=%d - duration=%d",