[MOVED FROM GST-P-FARSIGHT] Put non-zero duration in first packet and put a minimum duration of 50ms

20070712195528-3e2dc-d46edeaab84fb55e74842bdcf4f8792dfcdb0457.gz
This commit is contained in:
Olivier Crete 2007-07-12 19:55:28 +00:00 committed by Edward Hervey
parent 230ee96a32
commit 074189363e

View file

@ -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));
/* 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);
/* duration of DTMF payload */
dtmfsrc->payload->duration +=
dtmfsrc->interval * dtmfsrc->clock_rate / 1000;
}
static GstBuffer *