summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2007-07-12 19:55:28 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:47:59 +0100
commit074189363e4def66041756597462b788773762cd (patch)
treee3a04675c81b7ab1e3328f2573f5623eb0de9365 /gst
parent230ee96a32c7fd9f769131650ffc72659baef77d (diff)
downloadgst-plugins-bad-074189363e4def66041756597462b788773762cd.tar.gz
gst-plugins-bad-074189363e4def66041756597462b788773762cd.tar.bz2
gst-plugins-bad-074189363e4def66041756597462b788773762cd.zip
[MOVED FROM GST-P-FARSIGHT] Put non-zero duration in first packet and put a minimum duration of 50ms
20070712195528-3e2dc-d46edeaab84fb55e74842bdcf4f8792dfcdb0457.gz
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpdtmf/gstrtpdtmfsrc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.c b/gst/rtpdtmf/gstrtpdtmfsrc.c
index a31957f9..b20254ea 100644
--- a/gst/rtpdtmf/gstrtpdtmfsrc.c
+++ b/gst/rtpdtmf/gstrtpdtmfsrc.c
@@ -144,6 +144,7 @@
#define MAX_EVENT_STRING "16"
#define MIN_VOLUME 0
#define MAX_VOLUME 36
+#define MIN_EVENT_DURATION 50
#define DEFAULT_PACKET_REDUNDANCY 1
#define MIN_PACKET_REDUNDANCY 1
@@ -659,6 +660,10 @@ gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
gst_rtp_dtmf_prepare_rtp_headers (dtmfsrc, buf);
+ /* duration of DTMF payload */
+ dtmfsrc->payload->duration +=
+ dtmfsrc->interval * dtmfsrc->clock_rate / 1000;
+
/* timestamp and duration of GstBuffer */
GST_BUFFER_DURATION (buf) = dtmfsrc->interval * GST_MSECOND;
GST_BUFFER_TIMESTAMP (buf) = dtmfsrc->timestamp;
@@ -668,12 +673,14 @@ gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
/* copy payload and convert to network-byte order */
g_memmove (payload, dtmfsrc->payload, sizeof (GstRTPDTMFPayload));
- payload->duration = g_htons (payload->duration);
-
- /* duration of DTMF payload */
- dtmfsrc->payload->duration +=
- dtmfsrc->interval * dtmfsrc->clock_rate / 1000;
+ /* Force the packet duration to a certain minumum
+ * if its the end of the event
+ */
+ if (payload->e &&
+ payload->duration < MIN_EVENT_DURATION * dtmfsrc->clock_rate / 1000)
+ payload->duration = MIN_EVENT_DURATION * dtmfsrc->clock_rate / 1000;
+ payload->duration = g_htons (payload->duration);
}
static GstBuffer *