- ongoing work to ease jitter & RTT calculation
This commit is contained in:
parent
d90940c907
commit
0607bd1c47
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright(C) 2007-2016 VoIP objects (voipobjects.com)
|
/* Copyright(C) 2007-2023 VoIP objects (voipobjects.com)
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
|
||||||
|
|
@ -296,9 +296,9 @@ void AudioStream::dataArrived(PDatagramSocket s, const void* buffer, int length,
|
||||||
assert(info);
|
assert(info);
|
||||||
|
|
||||||
// Drop RTP packets if stream is not receiving now; let RTCP go
|
// Drop RTP packets if stream is not receiving now; let RTCP go
|
||||||
if (!(state() & (int)StreamState::Receiving) && RtpHelper::isRtp(buffer, length))
|
if (!(state() & (int)StreamState::Receiving) && RtpHelper::isRtpOrRtcp(buffer, length))
|
||||||
{
|
{
|
||||||
ICELogMedia(<< "Stream is not allowed to receive RTP stream. Ignore the packet");
|
ICELogMedia(<< "Stream is not allowed to receive RTP stream. Ignore the RT(C)P packet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -320,8 +320,6 @@ void AudioStream::dataArrived(PDatagramSocket s, const void* buffer, int length,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ICELogDebug(<< "Packet no: " << RtpHelper::findPacketNo(mReceiveBuffer, receiveLength));
|
|
||||||
|
|
||||||
switch (source.family())
|
switch (source.family())
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
|
@ -360,6 +358,7 @@ void AudioStream::dataArrived(PDatagramSocket s, const void* buffer, int length,
|
||||||
if (packet)
|
if (packet)
|
||||||
{
|
{
|
||||||
ICELogMedia(<< "jrtplib returned packet");
|
ICELogMedia(<< "jrtplib returned packet");
|
||||||
|
|
||||||
// Find right handler for rtp stream
|
// Find right handler for rtp stream
|
||||||
SingleAudioStream* rtpStream = nullptr;
|
SingleAudioStream* rtpStream = nullptr;
|
||||||
AudioStreamMap::iterator streamIter = mStreamMap.find(packet->GetSSRC());
|
AudioStreamMap::iterator streamIter = mStreamMap.find(packet->GetSSRC());
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ PStream Terminal::createStream(int type, VariantMap& /*config*/)
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Stream::Audio:
|
case Stream::Audio:
|
||||||
result = PStream(new AudioStream(MT::CodecList::Settings::DefaultSettings));
|
result = std::make_shared<AudioStream>(MT::CodecList::Settings::DefaultSettings);
|
||||||
mAudioList.add(result);
|
mAudioList.add(result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ RTCPScheduler::~RTCPScheduler()
|
||||||
|
|
||||||
void RTCPScheduler::Reset()
|
void RTCPScheduler::Reset()
|
||||||
{
|
{
|
||||||
|
pmembers = 0;
|
||||||
headeroverhead = 0; // user has to set this to an appropriate value
|
headeroverhead = 0; // user has to set this to an appropriate value
|
||||||
hassentrtcp = false;
|
hassentrtcp = false;
|
||||||
firstcall = true;
|
firstcall = true;
|
||||||
|
|
|
||||||
|
|
@ -900,9 +900,26 @@ void RTPExternalTransmitter::InjectRTPorRTCP(const void *data, size_t len, const
|
||||||
AbortWaitInternal();
|
AbortWaitInternal();
|
||||||
|
|
||||||
MAINMUTEX_UNLOCK
|
MAINMUTEX_UNLOCK
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RTPExternalTransmitter::InjectRaw(RTPRawPacket* packet)
|
||||||
|
{
|
||||||
|
if (!init)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MAINMUTEX_LOCK
|
||||||
|
if (!created)
|
||||||
|
{
|
||||||
|
MAINMUTEX_UNLOCK
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rawpacketlist.push_back(packet);
|
||||||
|
AbortWaitInternal();
|
||||||
|
|
||||||
|
MAINMUTEX_UNLOCK
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef RTPDEBUG
|
#ifdef RTPDEBUG
|
||||||
void RTPExternalTransmitter::Dump()
|
void RTPExternalTransmitter::Dump()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@ public:
|
||||||
|
|
||||||
/** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */
|
/** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */
|
||||||
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
||||||
|
|
||||||
|
void InjectRaw(RTPRawPacket* packet);
|
||||||
private:
|
private:
|
||||||
RTPExternalTransmitter *transmitter;
|
RTPExternalTransmitter *transmitter;
|
||||||
};
|
};
|
||||||
|
|
@ -186,6 +188,8 @@ public:
|
||||||
void InjectRTP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTP(const void *data, size_t len, const RTPAddress &a);
|
||||||
void InjectRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTCP(const void *data, size_t len, const RTPAddress &a);
|
||||||
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
||||||
|
void InjectRaw(RTPRawPacket* packet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FlushPackets();
|
void FlushPackets();
|
||||||
|
|
||||||
|
|
@ -233,6 +237,11 @@ inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, size_t
|
||||||
transmitter->InjectRTPorRTCP(data, len, a);
|
transmitter->InjectRTPorRTCP(data, len, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void RTPExternalPacketInjecter::InjectRaw(RTPRawPacket* packet)
|
||||||
|
{
|
||||||
|
transmitter->InjectRaw(packet);
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
#endif // RTPTCPSOCKETTRANSMITTER_H
|
#endif // RTPTCPSOCKETTRANSMITTER_H
|
||||||
|
|
|
||||||
|
|
@ -1444,8 +1444,8 @@ int RTPSession::ProcessPolledData()
|
||||||
RTPTime colltimeout = RTPTime(Td*collisionmultiplier);
|
RTPTime colltimeout = RTPTime(Td*collisionmultiplier);
|
||||||
RTPTime notetimeout = RTPTime(Td*notemultiplier);
|
RTPTime notetimeout = RTPTime(Td*notemultiplier);
|
||||||
|
|
||||||
sources.MultipleTimeouts(t,sendertimeout,byetimeout,generaltimeout,notetimeout);
|
// sources.MultipleTimeouts(t,sendertimeout,byetimeout,generaltimeout,notetimeout);
|
||||||
collisionlist.Timeout(t,colltimeout);
|
// collisionlist.Timeout(t,colltimeout);
|
||||||
|
|
||||||
// We'll check if it's time for RTCP stuff
|
// We'll check if it's time for RTCP stuff
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@
|
||||||
#include <jthread/jmutex.h>
|
#include <jthread/jmutex.h>
|
||||||
#endif // RTP_SUPPORT_THREAD
|
#endif // RTP_SUPPORT_THREAD
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace jrtplib
|
namespace jrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -474,7 +476,11 @@ protected:
|
||||||
const uint8_t *cname,size_t cnamelength) { }
|
const uint8_t *cname,size_t cnamelength) { }
|
||||||
|
|
||||||
/** Is called when a new entry \c srcdat is added to the source table. */
|
/** Is called when a new entry \c srcdat is added to the source table. */
|
||||||
virtual void OnNewSource(RTPSourceData *srcdat) { }
|
virtual void OnNewSource(RTPSourceData *srcdat)
|
||||||
|
{
|
||||||
|
// Sync timestamp unit
|
||||||
|
srcdat->SetTimestampUnit(timestampunit);
|
||||||
|
}
|
||||||
|
|
||||||
/** Is called when the entry \c srcdat is about to be deleted from the source table. */
|
/** Is called when the entry \c srcdat is about to be deleted from the source table. */
|
||||||
virtual void OnRemoveSource(RTPSourceData *srcdat) { }
|
virtual void OnRemoveSource(RTPSourceData *srcdat) { }
|
||||||
|
|
|
||||||
|
|
@ -809,6 +809,8 @@ int RTPSources::ObtainSourceDataInstance(uint32_t ssrc,RTPInternalSourceData **s
|
||||||
#endif // RTP_SUPPORT_PROBATION
|
#endif // RTP_SUPPORT_PROBATION
|
||||||
if (srcdat2 == 0)
|
if (srcdat2 == 0)
|
||||||
return ERR_RTP_OUTOFMEM;
|
return ERR_RTP_OUTOFMEM;
|
||||||
|
|
||||||
|
// Add new source item
|
||||||
if ((status = sourcelist.AddElement(ssrc,srcdat2)) < 0)
|
if ((status = sourcelist.AddElement(ssrc,srcdat2)) < 0)
|
||||||
{
|
{
|
||||||
RTPDelete(srcdat2,GetMemoryManager());
|
RTPDelete(srcdat2,GetMemoryManager());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue