Resync sequence and timestamp on new SSRC. Provide the marker bit for decision.
git-svn-id: http://voip.null.ro/svn/yate@1732 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4a518bfa34
commit
8df3930be7
|
@ -112,16 +112,21 @@ void RTPReceiver::rtpData(const void* data, int len)
|
|||
m_warn = true;
|
||||
}
|
||||
|
||||
if (ss != m_ssrc)
|
||||
rtpNewSSRC(ss);
|
||||
// check if the SSRC is still unchanged
|
||||
if (ss != m_ssrc) {
|
||||
if (m_warn) {
|
||||
m_warn = false;
|
||||
Debug(DebugWarn,"RTP Received SSRC %08X but expecting %08X [%p]",
|
||||
ss,m_ssrc,this);
|
||||
rtpNewSSRC(ss,marker);
|
||||
// check if the SSRC is still unchanged
|
||||
if (ss != m_ssrc) {
|
||||
if (m_warn) {
|
||||
m_warn = false;
|
||||
Debug(DebugWarn,"RTP Received SSRC %08X but expecting %08X [%p]",
|
||||
ss,m_ssrc,this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
// SSRC accepted, sync sequence but drop this packet as duplicate
|
||||
m_seq = seq;
|
||||
// resync the timestamps, next packet will come in correctly
|
||||
m_ts = ts - m_tsLast;
|
||||
}
|
||||
|
||||
// substraction with overflow
|
||||
|
@ -194,10 +199,10 @@ void RTPReceiver::rtpNewPayload(int payload, unsigned int timestamp)
|
|||
m_session->rtpNewPayload(payload,timestamp);
|
||||
}
|
||||
|
||||
void RTPReceiver::rtpNewSSRC(u_int32_t newSsrc)
|
||||
void RTPReceiver::rtpNewSSRC(u_int32_t newSsrc, bool marker)
|
||||
{
|
||||
if (m_session)
|
||||
m_session->rtpNewSSRC(newSsrc);
|
||||
m_session->rtpNewSSRC(newSsrc,marker);
|
||||
}
|
||||
|
||||
bool RTPReceiver::decodeEvent(bool marker, unsigned int timestamp, const void* data, int len)
|
||||
|
@ -451,10 +456,10 @@ void RTPSession::rtpNewPayload(int payload, unsigned int timestamp)
|
|||
payload,timestamp,this);
|
||||
}
|
||||
|
||||
void RTPSession::rtpNewSSRC(u_int32_t newSsrc)
|
||||
void RTPSession::rtpNewSSRC(u_int32_t newSsrc,bool marker)
|
||||
{
|
||||
XDebug(DebugAll,"RTPSession::rtpNewSSRC(%08X) [%p]",
|
||||
newSsrc,this);
|
||||
XDebug(DebugAll,"RTPSession::rtpNewSSRC(%08X,%s) [%p]",
|
||||
newSsrc,String::boolText(marker),this);
|
||||
}
|
||||
|
||||
RTPSender* RTPSession::createSender()
|
||||
|
|
|
@ -533,8 +533,9 @@ public:
|
|||
* just before processing further. This is a good opportunity to
|
||||
* change the SSRC and continue
|
||||
* @param newSsrc SSRC received in packet
|
||||
* @param marker True if marker bit is set in the RTP packet
|
||||
*/
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc);
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc, bool marker);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -709,8 +710,9 @@ public:
|
|||
* just before processing further. This is a good opportunity to
|
||||
* change the SSRC and continue
|
||||
* @param newSsrc SSRC received in packet
|
||||
* @param marker True if marker bit is set in the RTP packet
|
||||
*/
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc);
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc, bool marker);
|
||||
|
||||
/**
|
||||
* Create a new RTP sender for this session.
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
virtual bool rtpRecvEvent(int event, char key, int duration,
|
||||
int volume, unsigned int timestamp);
|
||||
virtual void rtpNewPayload(int payload, unsigned int timestamp);
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc);
|
||||
virtual void rtpNewSSRC(u_int32_t newSsrc, bool marker);
|
||||
inline void resync()
|
||||
{ m_resync = true; }
|
||||
inline void anySSRC(bool acceptAny = true)
|
||||
|
@ -552,7 +552,7 @@ void YRTPSession::rtpNewPayload(int payload, unsigned int timestamp)
|
|||
}
|
||||
}
|
||||
|
||||
void YRTPSession::rtpNewSSRC(u_int32_t newSsrc)
|
||||
void YRTPSession::rtpNewSSRC(u_int32_t newSsrc, bool marker)
|
||||
{
|
||||
if ((m_anyssrc || m_resync) && receiver()) {
|
||||
m_resync = false;
|
||||
|
|
Loading…
Reference in New Issue