From 9345b3e35fe487b3a83970c51d34e6ecb9497811 Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Fri, 26 May 2006 14:11:07 +0000 Subject: RTP timestamp corrective delta is now always applied because in some cases, it produced garbled output on one side of the conversation. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@242 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 23 ++++++++++------------- orkaudio/audiocaptureplugins/voip/RtpSession.h | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index d59e43d..1e18e45 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -45,7 +45,7 @@ RtpSession::RtpSession(CStdString& trackingId) m_numRtpPackets = 0; m_started = false; m_stopped = false; - m_rtpTimestampCorrectiveOffset = 0; + m_rtpTimestampCorrectiveDelta = 0; } void RtpSession::Stop() @@ -334,27 +334,24 @@ void RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket) } } - // Compute the corrective offset (only if the two streams have greatly different timestamp, eg for Cisco CallManager) - if(m_rtpTimestampCorrectiveOffset == 0 && m_lastRtpPacketSide2.get() != NULL) + // Compute the corrective offset + if(m_rtpTimestampCorrectiveDelta == 0 && m_lastRtpPacketSide2.get() != NULL) { - //if (m_lastRtpPacketSide2->m_arrivalTimestamp == m_lastRtpPacketSide1->m_arrivalTimestamp) + int timestampOffset = m_lastRtpPacketSide2->m_timestamp - m_lastRtpPacketSide1->m_timestamp; + //if(timestampOffset > 8000 || timestampOffset < -8000) // 1s @ 8KHz //{ - int timestampOffset = m_lastRtpPacketSide2->m_timestamp - m_lastRtpPacketSide1->m_timestamp; - if(timestampOffset > 8000 || timestampOffset < -8000) // 1s @ 8KHz + m_rtpTimestampCorrectiveDelta = timestampOffset; + if(m_log->isDebugEnabled()) { - m_rtpTimestampCorrectiveOffset = timestampOffset; - if(m_log->isDebugEnabled()) - { - CStdString timestampOffsetString = IntToString(timestampOffset); - LOG4CXX_DEBUG(m_log, m_trackingId + ": " + m_capturePort + ": " + "Applying timestamp corrective offset:" + timestampOffsetString); - } + CStdString timestampOffsetString = IntToString(timestampOffset); + LOG4CXX_DEBUG(m_log, m_trackingId + ": " + m_capturePort + ": " + "Applying timestamp corrective offset:" + timestampOffsetString); } //} } // apply the corrective offset if(m_lastRtpPacketSide2.get() != NULL) { - m_lastRtpPacketSide2->m_timestamp = m_lastRtpPacketSide2->m_timestamp - m_rtpTimestampCorrectiveOffset; + m_lastRtpPacketSide2->m_timestamp = m_lastRtpPacketSide2->m_timestamp - m_rtpTimestampCorrectiveDelta; } if(m_log->isDebugEnabled()) diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h index a745c38..45a60cd 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.h +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h @@ -121,7 +121,7 @@ private: CStdString m_capturePort; bool m_started; bool m_stopped; - int m_rtpTimestampCorrectiveOffset; + int m_rtpTimestampCorrectiveDelta; }; typedef boost::shared_ptr RtpSessionRef; -- cgit v1.2.3