diff options
author | Henri Herscher <henri@oreka.org> | 2006-11-21 16:54:22 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2006-11-21 16:54:22 +0000 |
commit | 912e5f6d9ece10118c2d0c6e977cbd562c58ac22 (patch) | |
tree | 3efbc939a32fd9c475767e845a2f730d41cc6c4e /orkaudio/audiocaptureplugins/voip/VoIp.cpp | |
parent | 333ff550be4f631b02dd67b88711c4a4d77c2b93 (diff) |
Introduced PcatTest VoIP config parameter that puts orkaudio in a mode where it purely gets packets as fast as possible and reports stats every 10 seconds.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@355 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins/voip/VoIp.cpp')
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 16a8d27..0b3d378 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -507,6 +507,19 @@ void HandleSkinnyMessage(SkinnyHeaderStruct* skinnyHeader, IpHeaderStruct* ipHea void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) { + time_t now = time(NULL); + + if(s_liveCapture && (now - s_lastPcapStatsReportingTime) > 10) + { + MutexSentinel mutexSentinel(s_mutex); // serialize access for competing pcap threads + s_lastPcapStatsReportingTime = now; + VoIpSingleton::instance()->ReportPcapStats(); + } + if(DLLCONFIG.m_pcapTest) + { + return; + } + EthernetHeaderStruct* ethernetHeader = (EthernetHeaderStruct *)pkt_data; IpHeaderStruct* ipHeader = (IpHeaderStruct*)((char*)ethernetHeader + sizeof(EthernetHeaderStruct)); if(ipHeader->ip_v != 4) // sanity check, is it an IP packet v4 @@ -532,8 +545,6 @@ void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char int ipHeaderLength = ipHeader->ip_hl*4; u_char* ipPacketEnd = (u_char*)ipHeader + ntohs(ipHeader->ip_len); - time_t now = time(NULL); - #ifdef WIN32 if(!s_liveCapture) { @@ -604,11 +615,6 @@ void HandlePacket(u_char *param, const struct pcap_pkthdr *header, const u_char { detectedUsefulPacket = TrySipBye(ethernetHeader, ipHeader, udpHeader, udpPayload); } - if(detectedUsefulPacket && s_liveCapture && (now - s_lastPcapStatsReportingTime) > 10) - { - s_lastPcapStatsReportingTime = now; - VoIpSingleton::instance()->ReportPcapStats(); - } } } else if(ipHeader->ip_p == IPPROTO_TCP) @@ -951,7 +957,7 @@ void VoIp::ReportPcapStats() struct pcap_stat stats; pcap_stats(*it, &stats); CStdString logMsg; - logMsg.Format("received:%u dropped:%u", stats.ps_recv, stats.ps_drop); + logMsg.Format("handle:%x received:%u dropped:%u", *it, stats.ps_recv, stats.ps_drop); LOG4CXX_INFO(s_packetStatsLog, logMsg) } } |