propagate event TS to aggregating DTMF detector. this help detecting same key presses that follow each other closely

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1833 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 17 years ago
parent d4d7fa1bf6
commit 971500b0b5

@ -182,7 +182,8 @@ AmDtmfDetector::AmDtmfDetector(AmSession *session)
m_eventPending(false), m_sipEventReceived(false),
m_inbandEventReceived(false), m_rtpEventReceived(false),
m_inband_type(Dtmf::SEMSInternal),
m_currentEvent(-1)
m_currentEvent(-1),
m_current_eventid_i(false)
{
#ifndef USE_SPANDSP
setInbandDetector(Dtmf::SEMSInternal);
@ -240,16 +241,22 @@ void AmDtmfDetector::process(AmEvent *evt)
void AmDtmfDetector::registerKeyReleased(int event, Dtmf::EventSource source,
const struct timeval& start,
const struct timeval& stop,
bool flush)
bool flush,
bool has_eventid, unsigned int event_id)
{
// Old event has not been sent yet
// push out it now
if (flush || (m_eventPending && m_currentEvent != event))
if (flush || (m_eventPending && m_currentEvent != event) ||
(m_eventPending && has_eventid && m_current_eventid_i && (event_id != m_current_eventid)))
{
reportEvent();
}
m_eventPending = true;
m_currentEvent = event;
m_current_eventid_i = true;
m_current_eventid = event_id;
memcpy(&m_startTime, &start, sizeof(struct timeval));
memcpy(&m_lastReportTime, &stop, sizeof(struct timeval));
switch (source)
@ -325,6 +332,7 @@ void AmDtmfDetector::reportEvent()
m_sipEventReceived = false;
m_rtpEventReceived = false;
m_inbandEventReceived = false;
m_current_eventid_i = false;
m_reportLock.unlock();
}
@ -388,7 +396,7 @@ void AmRtpDtmfDetector::sendPending(bool flush)
{
struct timeval end_time;
gettimeofday(&end_time, NULL);
m_keysink->registerKeyReleased(m_currentEvent, Dtmf::SOURCE_RTP, m_startTime, end_time, flush);
m_keysink->registerKeyReleased(m_currentEvent, Dtmf::SOURCE_RTP, m_startTime, end_time, flush, true, m_currentTS);
m_eventPending = false;
m_currentTS_i = false;
m_lastTS = m_currentTS;

@ -132,7 +132,8 @@ class AmKeyPressSink {
* @param flush whether key should be registered as own keypress immediately
*/
virtual void registerKeyReleased(int event, Dtmf::EventSource source,
const struct timeval& start, const struct timeval& stop, bool flush=false) = 0;
const struct timeval& start, const struct timeval& stop, bool flush=false,
bool has_eventid = false, unsigned int event_id = 0) = 0;
/**
* Through this method the AmDtmfDetector receives events that was
* detected by specific detectors.
@ -397,6 +398,9 @@ class AmDtmfDetector
int m_currentEvent;
bool m_eventPending;
bool m_current_eventid_i;
unsigned int m_current_eventid;
bool m_sipEventReceived;
bool m_inbandEventReceived;
bool m_rtpEventReceived;
@ -420,10 +424,12 @@ class AmDtmfDetector
* @param start time when key was pressed
* @param stop time when key was released
* @param flush whether key should be registered as own keypress immediately
* @param has_eventid whether event has an id
* @param event_id id of the event
*/
void registerKeyReleased(int event, Dtmf::EventSource source,
const struct timeval& start, const struct timeval& stop,
bool flush=false);
bool flush=false, bool has_eventid = false, unsigned int event_id = 0);
/**
* Through this method the AmDtmfDetector receives events that was
* detected by specific detectors.

Loading…
Cancel
Save