From 84d45bf1e53449fed92c08c9950b65053ea22f7a Mon Sep 17 00:00:00 2001 From: Gerald Begumisa Date: Fri, 28 Sep 2007 16:47:30 +0000 Subject: Adjustment to solve a potential performance problem that could arise from the load toll associated with repeated string comparison git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@498 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 11 ++++++++--- orkaudio/audiocaptureplugins/voip/RtpSession.h | 2 ++ orkaudio/audiocaptureplugins/voip/VoIp.cpp | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'orkaudio/audiocaptureplugins/voip') diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index c52d9b6..95e3ff2 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -62,6 +62,7 @@ RtpSession::RtpSession(CStdString& trackingId) m_currentDtmfDuration = 0; m_currentRtpEventTs = 0; m_currentDtmfVolume = 0; + m_sessionTelephoneEventPtDefined = false; } void RtpSession::Stop() @@ -599,7 +600,7 @@ bool RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket) if(DLLCONFIG.m_rtpReportDtmf) { /* Check if this is a telephone-event */ - if(m_telephoneEventPayloadType.CompareNoCase("UNDEFINED") != 0) + if(m_sessionTelephoneEventPtDefined) { if(rtpPacket->m_payloadType == StringToInt(m_telephoneEventPayloadType)) { @@ -806,7 +807,11 @@ void RtpSession::ReportSipInvite(SipInviteInfoRef& invite) LOG4CXX_INFO(m_log, logMsg); } m_invites.push_front(invite); - m_telephoneEventPayloadType = invite->m_telephoneEventPayloadType; + if(invite->m_telephoneEventPtDefined) + { + m_telephoneEventPayloadType = invite->m_telephoneEventPayloadType; + m_sessionTelephoneEventPtDefined = true; + } // Gather extracted fields std::copy(invite->m_extractedFields.begin(), invite->m_extractedFields.end(), std::inserter(m_tags, m_tags.begin())); @@ -1850,7 +1855,7 @@ SipInviteInfo::SipInviteInfo() m_fromRtpIp.s_addr = 0; m_validated = false; m_attrSendonly = false; - m_telephoneEventPayloadType = "UNDEFINED"; + m_telephoneEventPtDefined = false; } void SipInviteInfo::ToString(CStdString& string) diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h index 9c59593..ec6d36f 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.h +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h @@ -43,6 +43,7 @@ public: bool m_attrSendonly; // true if the SDP has a:sendonly std::map m_extractedFields; CStdString m_telephoneEventPayloadType; + bool m_telephoneEventPtDefined; time_t m_recvTime; }; @@ -177,6 +178,7 @@ private: TcpAddressList m_rtpAddressList; std::list m_invites; std::map m_tags; + bool m_sessionTelephoneEventPtDefined; CStdString m_telephoneEventPayloadType; unsigned short m_currentRtpEvent; diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 4790c7c..02eb13a 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -1663,6 +1663,7 @@ bool TrySipInvite(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader /* Our DTMF packets are indicated using * the payload type rtpPayloadType */ info->m_telephoneEventPayloadType = rtpPayloadType; + info->m_telephoneEventPtDefined = true; break; } } -- cgit v1.2.3