CStdString debug; debug.Format("%s,%d seq:%u ts:%u len:%d", ACE_OS::inet_ntoa(rtpInfo->m_sourceIp), rtpInfo->m_sourcePort, ntohs(rtpHeader->seq), ntohl(rtpHeader->ts), payloadLength); LOG4CXX_DEBUG(s_log, debug);
if(s_rtpPacketLog->isDebugEnabled()) { CStdString debug; char sourceIp[16]; ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_src, sourceIp, sizeof(sourceIp)); char destIp[16]; ACE_OS::inet_ntop(AF_INET, (void*)&ipHeader->ip_dest, destIp, sizeof(destIp)); debug.Format("%s,%d %s,%d seq:%u ts:%u len:%d", sourceIp, rtpInfo->m_sourcePort, destIp, rtpInfo->m_destPort, ntohs(rtpHeader->seq), ntohl(rtpHeader->ts), payloadLength); LOG4CXX_DEBUG(s_rtpPacketLog, debug); }
bool TryRtp(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader, UdpHeaderStruct* udpHeader, u_char* udpPayload){	bool result = false;	RtpHeaderStruct* rtpHeader = (RtpHeaderStruct*)udpPayload;	if (rtpHeader->version == 2)	{		u_short source = ntohs(udpHeader->source);		u_short dest = ntohs(udpHeader->dest);		if(!(ntohs(udpHeader->source)%2) && !(ntohs(udpHeader->dest)%2))	// udp ports must be even 		{			if(rtpHeader->pt == RTP_PT_PCMU || rtpHeader->pt == RTP_PT_PCMA)			{				result = true;				u_char* payload = (u_char *)rtpHeader + sizeof(RtpHeaderStruct);				u_char* packetEnd = (u_char *)ipHeader + ntohs(ipHeader->ip_len);				u_int payloadLength = packetEnd - payload;				RtpPacketInfoRef rtpInfo(new RtpPacketInfo());				rtpInfo->m_sourceIp = ipHeader->ip_src;				rtpInfo->m_destIp =  ipHeader->ip_dest;				rtpInfo->m_sourcePort = ntohs(udpHeader->source);				rtpInfo->m_destPort = ntohs(udpHeader->dest);				rtpInfo->m_payloadSize = payloadLength;				rtpInfo->m_payloadType = rtpHeader->pt;				rtpInfo->m_seqNum = ntohs(rtpHeader->seq);				rtpInfo->m_timestamp = ntohl(rtpHeader->ts);				rtpInfo->m_payload = payload;				CStdString debug;				debug.Format("%s,%d seq:%u ts:%u len:%d", ACE_OS::inet_ntoa(rtpInfo->m_sourceIp), rtpInfo->m_sourcePort, ntohs(rtpHeader->seq), ntohl(rtpHeader->ts), payloadLength);				LOG4CXX_DEBUG(s_log, debug);				RtpSessionsSingleton::instance()->ReportRtpPacket(rtpInfo);			}		}	}	return result;}