SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
qrtplib::RTPSession Class Reference

#include <rtpsession.h>

+ Collaboration diagram for qrtplib::RTPSession:

Public Member Functions

 RTPSession (RTPRandom *rnd=0)
 
virtual ~RTPSession ()
 
int Create (const RTPSessionParams &sessparams, RTPTransmitter *transmitter)
 
void Destroy ()
 
void BYEDestroy (const RTPTime &maxwaittime, const void *reason, std::size_t reasonlength)
 
bool IsActive ()
 
uint32_t GetLocalSSRC ()
 
int AddDestination (const RTPAddress &addr)
 
int DeleteDestination (const RTPAddress &addr)
 
void ClearDestinations ()
 
bool SupportsMulticasting ()
 
int JoinMulticastGroup (const RTPAddress &addr)
 
int LeaveMulticastGroup (const RTPAddress &addr)
 
int SendPacket (const void *data, std::size_t len)
 
int SendPacket (const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc)
 
int SendPacketEx (const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
 
int SendPacketEx (const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
 
int SendRTCPAPPPacket (uint8_t subtype, const uint8_t name[4], const void *appdata, std::size_t appdatalen)
 
int SendRawData (const void *data, std::size_t len, bool usertpchannel)
 
int SetDefaultPayloadType (uint8_t pt)
 
int SetDefaultMark (bool m)
 
int SetDefaultTimestampIncrement (uint32_t timestampinc)
 
int IncrementTimestamp (uint32_t inc)
 
int IncrementTimestampDefault ()
 
int SetPreTransmissionDelay (const RTPTime &delay)
 
RTPTransmissionInfoGetTransmissionInfo ()
 
void DeleteTransmissionInfo (RTPTransmissionInfo *inf)
 
RTPTime GetRTCPDelay ()
 
int BeginDataAccess ()
 
bool GotoFirstSource ()
 
bool GotoNextSource ()
 
bool GotoPreviousSource ()
 
bool GotoFirstSourceWithData ()
 
bool GotoNextSourceWithData ()
 
bool GotoPreviousSourceWithData ()
 
RTPSourceDataGetCurrentSourceInfo ()
 
RTPSourceDataGetSourceInfo (uint32_t ssrc)
 
RTPPacketGetNextPacket ()
 
uint16_t GetNextSequenceNumber () const
 
void DeletePacket (RTPPacket *p)
 
int EndDataAccess ()
 
int SetReceiveMode (RTPTransmitter::ReceiveMode m)
 
int AddToIgnoreList (const RTPAddress &addr)
 
int DeleteFromIgnoreList (const RTPAddress &addr)
 
void ClearIgnoreList ()
 
int AddToAcceptList (const RTPAddress &addr)
 
int DeleteFromAcceptList (const RTPAddress &addr)
 
void ClearAcceptList ()
 
int SetMaximumPacketSize (std::size_t s)
 
int SetSessionBandwidth (double bw)
 
int SetTimestampUnit (double u)
 
void SetNameInterval (int count)
 
void SetEMailInterval (int count)
 
void SetLocationInterval (int count)
 
void SetPhoneInterval (int count)
 
void SetToolInterval (int count)
 
void SetNoteInterval (int count)
 
int SetLocalName (const void *s, std::size_t len)
 
int SetLocalEMail (const void *s, std::size_t len)
 
int SetLocalLocation (const void *s, std::size_t len)
 
int SetLocalPhone (const void *s, std::size_t len)
 
int SetLocalTool (const void *s, std::size_t len)
 
int SetLocalNote (const void *s, std::size_t len)
 

Protected Member Functions

virtual RTPTransmitterNewUserDefinedTransmitter ()
 
virtual void OnRTPPacket (RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 
virtual void OnRTCPCompoundPacket (RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 
virtual void OnSSRCCollision (RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)
 
virtual void OnCNAMECollision (RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength)
 
virtual void OnNewSource (RTPSourceData *srcdat)
 
virtual void OnRemoveSource (RTPSourceData *srcdat)
 
virtual void OnTimeout (RTPSourceData *srcdat)
 
virtual void OnBYETimeout (RTPSourceData *srcdat)
 
virtual void OnAPPPacket (RTCPAPPPacket *apppacket, const RTPTime &receivetime, const RTPAddress *senderaddress)
 
virtual void OnUnknownPacketType (RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 
virtual void OnUnknownPacketFormat (RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 
virtual void OnNoteTimeout (RTPSourceData *srcdat)
 
virtual void OnRTCPSenderReport (RTPSourceData *srcdat)
 
virtual void OnRTCPReceiverReport (RTPSourceData *srcdat)
 
virtual void OnRTCPSDESItem (RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength)
 
virtual void OnRTCPSDESPrivateItem (RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen)
 
virtual void OnBYEPacket (RTPSourceData *srcdat)
 
virtual void OnSendRTCPCompoundPacket (RTCPCompoundPacket *pack)
 
void SetChangeOutgoingData (bool change)
 
void SetChangeIncomingData (bool change)
 
virtual int OnChangeRTPOrRTCPData (const void *origdata, std::size_t origlen, bool isrtp, void **senddata, std::size_t *sendlen)
 
virtual void OnSentRTPOrRTCPData (void *senddata, std::size_t sendlen, bool isrtp)
 
virtual bool OnChangeIncomingData (RTPRawPacket *rawpack)
 
virtual void OnValidatedRTPPacket (RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled)
 

Private Member Functions

int InternalCreate (const RTPSessionParams &sessparams)
 
int CreateCNAME (uint8_t *buffer, std::size_t *bufferlength, bool resolve)
 
int ProcessPolledData ()
 
int ProcessRTCPCompoundPacket (RTCPCompoundPacket &rtcpcomppack, RTPRawPacket *pack)
 
RTPRandomGetRandomNumberGenerator (RTPRandom *r)
 
int SendRTPData (const void *data, std::size_t len)
 
int SendRTCPData (const void *data, std::size_t len)
 

Private Attributes

RTPRandomrtprnd
 
bool deletertprnd
 
RTPTransmitterrtptrans
 
bool created
 
bool deletetransmitter
 
bool usingpollthread
 
bool acceptownpackets
 
bool useSR_BYEifpossible
 
std::size_t maxpacksize
 
double sessionbandwidth
 
double controlfragment
 
double sendermultiplier
 
double byemultiplier
 
double membermultiplier
 
double collisionmultiplier
 
double notemultiplier
 
bool sentpackets
 
bool m_changeIncomingData
 
bool m_changeOutgoingData
 
RTPSessionSources sources
 
RTPPacketBuilder packetbuilder
 
RTCPScheduler rtcpsched
 
RTCPPacketBuilder rtcpbuilder
 
RTPCollisionList collisionlist
 
std::list< RTCPCompoundPacket * > byepackets
 

Friends

class RTPSessionSources
 
class RTCPSessionPacketBuilder
 

Detailed Description

High level class for using RTP. For most RTP based applications, the RTPSession class will probably be the one to use. It handles the RTCP part completely internally, so the user can focus on sending and receiving the actual data. In case you want to use SRTP, you should create an RTPSecureSession derived class.

Note
The RTPSession class is not meant to be thread safe. The user should use some kind of locking mechanism to prevent different threads from using the same RTPSession instance.

Definition at line 76 of file rtpsession.h.

Constructor & Destructor Documentation

◆ RTPSession()

qrtplib::RTPSession::RTPSession ( RTPRandom rnd = 0)

Constructs an RTPSession instance, optionally using a specific instance of a random number generator, and optionally installing a memory manager. Constructs an RTPSession instance, optionally using a specific instance of a random number generator, and optionally installing a memory manager. If no random number generator is specified, the RTPSession object will try to use either a RTPRandomURandom or RTPRandomRandS instance. If neither is available on the current platform, a RTPRandomRand48 instance will be used instead. By specifying a random number generator yourself, it is possible to use the same generator in several RTPSession instances.

Definition at line 60 of file rtpsession.cpp.

References created, qrtplib::RTPTimeInitializerObject::Dummy(), m_changeIncomingData, m_changeOutgoingData, and qrtplib::timeinit.

60  :
62  sources(*this),
66 {
67  // We're not going to set these flags in Create, so that the constructor of a derived class
68  // can already change them
69  m_changeIncomingData = false;
70  m_changeOutgoingData = false;
71 
72  created = false;
73  timeinit.Dummy();
74 
75  //std::cout << (void *)(rtprnd) << std::endl;
76 }
RTPTimeInitializerObject timeinit
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
RTPRandom * rtprnd
Definition: rtpsession.h:550
RTPSessionSources sources
Definition: rtpsession.h:571
RTPRandom * GetRandomNumberGenerator(RTPRandom *r)
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
+ Here is the call graph for this function:

◆ ~RTPSession()

qrtplib::RTPSession::~RTPSession ( )
virtual

Definition at line 78 of file rtpsession.cpp.

References deletertprnd, Destroy(), and rtprnd.

79 {
80  Destroy();
81 
82  if (deletertprnd)
83  delete rtprnd;
84 }
RTPRandom * rtprnd
Definition: rtpsession.h:550
+ Here is the call graph for this function:

Member Function Documentation

◆ AddDestination()

int qrtplib::RTPSession::AddDestination ( const RTPAddress addr)

Adds addr to the list of destinations.

Definition at line 415 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::AddDestination(), created, ERR_RTP_SESSION_NOTCREATED, and rtptrans.

Referenced by RTPSink::addDestination(), and RTPSink::setDestination().

416 {
417  if (!created)
419  return rtptrans->AddDestination(addr);
420 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int AddDestination(const RTPAddress &addr)=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToAcceptList()

int qrtplib::RTPSession::AddToAcceptList ( const RTPAddress addr)

Adds addr to the list of addresses to accept.

Definition at line 814 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::AddToAcceptList(), created, ERR_RTP_SESSION_NOTCREATED, and rtptrans.

815 {
816  if (!created)
818  return rtptrans->AddToAcceptList(addr);
819 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int AddToAcceptList(const RTPAddress &addr)=0
+ Here is the call graph for this function:

◆ AddToIgnoreList()

int qrtplib::RTPSession::AddToIgnoreList ( const RTPAddress addr)

Adds addr to the list of addresses to ignore.

Definition at line 793 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::AddToIgnoreList(), created, ERR_RTP_SESSION_NOTCREATED, and rtptrans.

794 {
795  if (!created)
797  return rtptrans->AddToIgnoreList(addr);
798 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
virtual int AddToIgnoreList(const RTPAddress &addr)=0
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ BeginDataAccess()

int qrtplib::RTPSession::BeginDataAccess ( )

The following member functions (till EndDataAccess}) need to be accessed between a call to BeginDataAccess and EndDataAccess. The BeginDataAccess function makes sure that the poll thread won't access the source table at the same time that you're using it. When the EndDataAccess is called, the lock on the source table is freed again.

Definition at line 699 of file rtpsession.cpp.

References created, and ERR_RTP_SESSION_NOTCREATED.

700 {
701  if (!created)
703  return 0;
704 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114

◆ BYEDestroy()

void qrtplib::RTPSession::BYEDestroy ( const RTPTime maxwaittime,
const void *  reason,
std::size_t  reasonlength 
)

Sends a BYE packet and leaves the session. Sends a BYE packet and leaves the session. At most a time maxwaittime will be waited to send the BYE packet. If this time expires, the session will be left without sending a BYE packet. The BYE packet will contain as reason for leaving reason with length reasonlength.

Definition at line 321 of file rtpsession.cpp.

References qrtplib::RTCPPacketBuilder::BuildBYEPacket(), byepackets, qrtplib::RTPCollisionList::Clear(), qrtplib::RTPSources::Clear(), collisionlist, created, qrtplib::RTPTime::CurrentTime(), deletetransmitter, qrtplib::RTPPacketBuilder::Destroy(), qrtplib::RTCPPacketBuilder::Destroy(), qrtplib::RTCPCompoundPacket::GetCompoundPacketData(), qrtplib::RTCPCompoundPacket::GetCompoundPacketLength(), qrtplib::RTCPScheduler::IsTime(), OnSendRTCPCompoundPacket(), packetbuilder, qrtplib::RTCPScheduler::Reset(), RTCP_BYE_MAXREASONLENGTH, rtcpbuilder, rtcpsched, rtptrans, qrtplib::RTCPScheduler::ScheduleBYEPacket(), SendRTCPData(), sentpackets, sources, useSR_BYEifpossible, and qrtplib::RTPTime::Wait().

Referenced by RTPSink::~RTPSink().

322 {
323  if (!created)
324  return;
325 
326  // first, stop the thread so we have full control over all components
327 
328  RTPTime stoptime = RTPTime::CurrentTime();
329  stoptime += maxwaittime;
330 
331  // add bye packet to the list if we've sent data
332 
333  RTCPCompoundPacket *pack;
334 
335  if (sentpackets)
336  {
337  int status;
338 
339  reasonlength = (reasonlength > RTCP_BYE_MAXREASONLENGTH) ? RTCP_BYE_MAXREASONLENGTH : reasonlength;
340  status = rtcpbuilder.BuildBYEPacket(&pack, reason, reasonlength, useSR_BYEifpossible);
341  if (status >= 0)
342  {
343  byepackets.push_back(pack);
344 
345  if (byepackets.size() == 1)
346  rtcpsched.ScheduleBYEPacket(pack->GetCompoundPacketLength());
347  }
348  }
349 
350  if (!byepackets.empty())
351  {
352  bool done = false;
353 
354  while (!done)
355  {
356  RTPTime curtime = RTPTime::CurrentTime();
357 
358  if (curtime >= stoptime)
359  done = true;
360 
361  if (rtcpsched.IsTime())
362  {
363  pack = *(byepackets.begin());
364  byepackets.pop_front();
365 
366  SendRTCPData(pack->GetCompoundPacketData(), pack->GetCompoundPacketLength());
367 
368  OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
369 
370  delete pack;
371  if (!byepackets.empty()) // more bye packets to send, schedule them
372  rtcpsched.ScheduleBYEPacket((*(byepackets.begin()))->GetCompoundPacketLength());
373  else
374  done = true;
375  }
376  if (!done)
377  RTPTime::Wait(RTPTime(0, 100000));
378  }
379  }
380 
381  if (deletetransmitter)
382  delete rtptrans;
385  rtcpsched.Reset();
387  sources.Clear();
388 
389  // clear rest of bye packets
390  std::list<RTCPCompoundPacket *>::const_iterator it;
391 
392  for (it = byepackets.begin(); it != byepackets.end(); it++)
393  delete *it;
394  byepackets.clear();
395 
396  created = false;
397 }
int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible=true)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define RTCP_BYE_MAXREASONLENGTH
Definition: rtpdefines.h:67
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
void ScheduleBYEPacket(std::size_t packetsize)
RTPSessionSources sources
Definition: rtpsession.h:571
int SendRTCPData(const void *data, std::size_t len)
RTPCollisionList collisionlist
Definition: rtpsession.h:575
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
std::list< RTCPCompoundPacket * > byepackets
Definition: rtpsession.h:577
static void Wait(const RTPTime &delay)
static RTPTime CurrentTime()
virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack)
Definition: rtpsession.h:642
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearAcceptList()

void qrtplib::RTPSession::ClearAcceptList ( )

Clears the list of addresses to accept.

Definition at line 828 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::ClearAcceptList(), created, and rtptrans.

829 {
830  if (!created)
831  return;
833 }
virtual void ClearAcceptList()=0
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ ClearDestinations()

void qrtplib::RTPSession::ClearDestinations ( )

Clears the list of destinations.

Definition at line 429 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::ClearDestinations(), created, and rtptrans.

Referenced by RTPSink::setDestination().

430 {
431  if (!created)
432  return;
434 }
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual void ClearDestinations()=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearIgnoreList()

void qrtplib::RTPSession::ClearIgnoreList ( )

Clears the list of addresses to ignore.

Definition at line 807 of file rtpsession.cpp.

References qrtplib::RTPTransmitter::ClearIgnoreList(), created, and rtptrans.

808 {
809  if (!created)
810  return;
812 }
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual void ClearIgnoreList()=0
+ Here is the call graph for this function:

◆ Create()

int qrtplib::RTPSession::Create ( const RTPSessionParams sessparams,
RTPTransmitter transmitter 
)

Creates an RTP session. This function creates an RTP session with parameters sessparams, which will use a transmitter corresponding to proto. Parameters for this transmitter can be specified as well. If proto is of type RTPTransmitter::UserDefinedProto, the NewUserDefinedTransmitter function must be implemented.Creates an RTP session using transmitter as transmission component. This function creates an RTP session with parameters sessparams, which will use the transmission component transmitter. Initialization and destruction of the transmitter will not be done by the RTPSession class if this Create function is used. This function can be useful if you which to reuse the transmission component in another RTPSession instance, once the original RTPSession isn't using the transmitter anymore.

Definition at line 145 of file rtpsession.cpp.

References created, deletetransmitter, ERR_RTP_SESSION_ALREADYCREATED, ERR_RTP_SESSION_MAXPACKETSIZETOOSMALL, qrtplib::RTPSessionParams::GetMaximumPacketSize(), qrtplib::RTPSessionParams::GetSenderReportForBYE(), InternalCreate(), qrtplib::RTPSessionParams::IsUsingPollThread(), maxpacksize, RTP_MINPACKETSIZE, rtptrans, sentpackets, qrtplib::RTPTransmitter::SetMaximumPacketSize(), useSR_BYEifpossible, and usingpollthread.

Referenced by RTPSink::RTPSink().

146 {
147  int status;
148 
149  if (created)
151 
152  usingpollthread = sessparams.IsUsingPollThread();
153 
154  useSR_BYEifpossible = sessparams.GetSenderReportForBYE();
155  sentpackets = false;
156 
157  // Check max packet size
158 
159  if ((maxpacksize = sessparams.GetMaximumPacketSize()) < RTP_MINPACKETSIZE)
161 
162  rtptrans = transmitter;
163 
164  if ((status = rtptrans->SetMaximumPacketSize(maxpacksize)) < 0)
165  return status;
166 
167  deletetransmitter = false;
168  return InternalCreate(sessparams);
169 }
#define ERR_RTP_SESSION_MAXPACKETSIZETOOSMALL
Definition: rtperrors.h:113
int InternalCreate(const RTPSessionParams &sessparams)
Definition: rtpsession.cpp:171
#define ERR_RTP_SESSION_ALREADYCREATED
Definition: rtperrors.h:110
#define RTP_MINPACKETSIZE
Definition: rtpdefines.h:39
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int SetMaximumPacketSize(std::size_t s)=0
std::size_t maxpacksize
Definition: rtpsession.h:559
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateCNAME()

int qrtplib::RTPSession::CreateCNAME ( uint8_t buffer,
std::size_t *  bufferlength,
bool  resolve 
)
private

Definition at line 1145 of file rtpsession.cpp.

References RTCP_SDES_MAXITEMLENGTH.

Referenced by InternalCreate().

1146 {
1147  (void) resolve;
1148  buffer[*bufferlength - 1] = 0;
1149 
1150  std::size_t offset = strlen((const char *) buffer);
1151  if (offset < (*bufferlength - 1))
1152  buffer[offset] = (uint8_t) '@';
1153  offset++;
1154 
1155  std::size_t buflen2 = *bufferlength - offset;
1156 
1157  QString hostnameStr = QHostInfo::localHostName();
1158  int hostnameSize = hostnameStr.size();
1159 
1160  strncpy((char * )(buffer + offset), hostnameStr.toStdString().c_str(), buflen2);
1161  *bufferlength = offset + hostnameSize;
1162 
1163  if (*bufferlength > RTCP_SDES_MAXITEMLENGTH)
1164  *bufferlength = RTCP_SDES_MAXITEMLENGTH;
1165 
1166  return 0;
1167 }
#define RTCP_SDES_MAXITEMLENGTH
Definition: rtpdefines.h:65
unsigned char uint8_t
Definition: rtptypes_win.h:42
+ Here is the caller graph for this function:

◆ DeleteDestination()

int qrtplib::RTPSession::DeleteDestination ( const RTPAddress addr)

Deletes addr from the list of destinations.

Definition at line 422 of file rtpsession.cpp.

References created, qrtplib::RTPTransmitter::DeleteDestination(), ERR_RTP_SESSION_NOTCREATED, and rtptrans.

Referenced by RTPSink::deleteDestination(), and RTPSink::setDestination().

423 {
424  if (!created)
426  return rtptrans->DeleteDestination(addr);
427 }
virtual int DeleteDestination(const RTPAddress &addr)=0
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromAcceptList()

int qrtplib::RTPSession::DeleteFromAcceptList ( const RTPAddress addr)

Deletes addr from the list of addresses to accept.

Definition at line 821 of file rtpsession.cpp.

References created, qrtplib::RTPTransmitter::DeleteFromAcceptList(), ERR_RTP_SESSION_NOTCREATED, and rtptrans.

822 {
823  if (!created)
825  return rtptrans->DeleteFromAcceptList(addr);
826 }
virtual int DeleteFromAcceptList(const RTPAddress &addr)=0
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ DeleteFromIgnoreList()

int qrtplib::RTPSession::DeleteFromIgnoreList ( const RTPAddress addr)

Deletes addr from the list of addresses to ignore.

Definition at line 800 of file rtpsession.cpp.

References created, qrtplib::RTPTransmitter::DeleteFromIgnoreList(), ERR_RTP_SESSION_NOTCREATED, and rtptrans.

801 {
802  if (!created)
804  return rtptrans->DeleteFromIgnoreList(addr);
805 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
virtual int DeleteFromIgnoreList(const RTPAddress &addr)=0
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ DeletePacket()

void qrtplib::RTPSession::DeletePacket ( RTPPacket p)

Frees the memory used by p.

Definition at line 774 of file rtpsession.cpp.

775 {
776  delete p;
777 }

◆ DeleteTransmissionInfo()

void qrtplib::RTPSession::DeleteTransmissionInfo ( RTPTransmissionInfo inf)

Frees the memory used by the transmission information inf.

Definition at line 681 of file rtpsession.cpp.

References created, qrtplib::RTPTransmitter::DeleteTransmissionInfo(), and rtptrans.

682 {
683  if (!created)
684  return;
686 }
virtual void DeleteTransmissionInfo(RTPTransmissionInfo *inf)=0
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ Destroy()

void qrtplib::RTPSession::Destroy ( )

Leaves the session without sending a BYE packet.

Definition at line 299 of file rtpsession.cpp.

References byepackets, qrtplib::RTPCollisionList::Clear(), qrtplib::RTPSources::Clear(), collisionlist, created, deletetransmitter, qrtplib::RTPPacketBuilder::Destroy(), qrtplib::RTCPPacketBuilder::Destroy(), packetbuilder, qrtplib::RTCPScheduler::Reset(), rtcpbuilder, rtcpsched, rtptrans, and sources.

Referenced by ~RTPSession().

300 {
301  if (!created)
302  return;
303 
304  if (deletetransmitter)
305  delete rtptrans;
308  rtcpsched.Reset();
310  sources.Clear();
311 
312  std::list<RTCPCompoundPacket *>::const_iterator it;
313 
314  for (it = byepackets.begin(); it != byepackets.end(); it++)
315  delete *it;
316  byepackets.clear();
317 
318  created = false;
319 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
RTPSessionSources sources
Definition: rtpsession.h:571
RTPCollisionList collisionlist
Definition: rtpsession.h:575
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
std::list< RTCPCompoundPacket * > byepackets
Definition: rtpsession.h:577
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndDataAccess()

int qrtplib::RTPSession::EndDataAccess ( )

See BeginDataAccess.

Definition at line 779 of file rtpsession.cpp.

References created, and ERR_RTP_SESSION_NOTCREATED.

780 {
781  if (!created)
783  return 0;
784 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114

◆ GetCurrentSourceInfo()

RTPSourceData * qrtplib::RTPSession::GetCurrentSourceInfo ( )

Returns the RTPSourceData instance for the currently selected participant.

Definition at line 748 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GetCurrentSourceInfo(), and sources.

749 {
750  if (!created)
751  return 0;
752  return sources.GetCurrentSourceInfo();
753 }
RTPSourceData * GetCurrentSourceInfo()
Definition: rtpsources.cpp:609
RTPSessionSources sources
Definition: rtpsession.h:571
+ Here is the call graph for this function:

◆ GetLocalSSRC()

uint32_t qrtplib::RTPSession::GetLocalSSRC ( )

Returns our own SSRC.

Definition at line 404 of file rtpsession.cpp.

References created, qrtplib::RTPPacketBuilder::GetSSRC(), and packetbuilder.

405 {
406  if (!created)
407  return 0;
408 
409  uint32_t ssrc;
410 
411  ssrc = packetbuilder.GetSSRC();
412  return ssrc;
413 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the call graph for this function:

◆ GetNextPacket()

RTPPacket * qrtplib::RTPSession::GetNextPacket ( )

Extracts the next packet from the received packets queue of the current participant, or NULL if no more packets are available. Extracts the next packet from the received packets queue of the current participant, or NULL if no more packets are available. When the packet is no longer needed, its memory should be freed using the DeletePacket member function.

Definition at line 762 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GetNextPacket(), and sources.

763 {
764  if (!created)
765  return 0;
766  return sources.GetNextPacket();
767 }
RTPSessionSources sources
Definition: rtpsession.h:571
RTPPacket * GetNextPacket()
Definition: rtpsources.cpp:630
+ Here is the call graph for this function:

◆ GetNextSequenceNumber()

uint16_t qrtplib::RTPSession::GetNextSequenceNumber ( ) const

Returns the Sequence Number that will be used in the next SendPacket function call.

Definition at line 769 of file rtpsession.cpp.

References qrtplib::RTPPacketBuilder::GetSequenceNumber(), and packetbuilder.

770 {
772 }
uint16_t GetSequenceNumber() const
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
+ Here is the call graph for this function:

◆ GetRandomNumberGenerator()

RTPRandom * qrtplib::RTPSession::GetRandomNumberGenerator ( RTPRandom r)
private

Definition at line 1169 of file rtpsession.cpp.

References qrtplib::RTPRandom::CreateDefaultRandomNumberGenerator(), and deletertprnd.

1170 {
1171  RTPRandom *rnew = 0;
1172 
1173  if (r == 0)
1174  {
1176  deletertprnd = true;
1177  }
1178  else
1179  {
1180  rnew = r;
1181  deletertprnd = false;
1182  }
1183 
1184  return rnew;
1185 }
static RTPRandom * CreateDefaultRandomNumberGenerator()
Definition: rtprandom.cpp:73
+ Here is the call graph for this function:

◆ GetRTCPDelay()

RTPTime qrtplib::RTPSession::GetRTCPDelay ( )

Returns the time interval after which an RTCP compound packet may have to be sent (only works when you're not using the poll thread.

Definition at line 688 of file rtpsession.cpp.

References created, qrtplib::RTCPScheduler::GetTransmissionDelay(), rtcpsched, and usingpollthread.

689 {
690  if (!created)
691  return RTPTime(0, 0);
692  if (usingpollthread)
693  return RTPTime(0, 0);
694 
695  RTPTime t = rtcpsched.GetTransmissionDelay();
696  return t;
697 }
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
+ Here is the call graph for this function:

◆ GetSourceInfo()

RTPSourceData * qrtplib::RTPSession::GetSourceInfo ( uint32_t  ssrc)

Returns the RTPSourceData instance for the participant identified by ssrc, or NULL if no such entry exists.

Definition at line 755 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GetSourceInfo(), and sources.

756 {
757  if (!created)
758  return 0;
759  return sources.GetSourceInfo(ssrc);
760 }
RTPSessionSources sources
Definition: rtpsession.h:571
RTPSourceData * GetSourceInfo(uint32_t ssrc)
Definition: rtpsources.cpp:616
+ Here is the call graph for this function:

◆ GetTransmissionInfo()

RTPTransmissionInfo * qrtplib::RTPSession::GetTransmissionInfo ( )

This function returns an instance of a subclass of RTPTransmissionInfo which will give some additional information about the transmitter (a list of local IP addresses for example). This function returns an instance of a subclass of RTPTransmissionInfo which will give some additional information about the transmitter (a list of local IP addresses for example). The user has to free the returned instance when it is no longer needed, preferably using the DeleteTransmissionInfo function.

Definition at line 674 of file rtpsession.cpp.

References created, qrtplib::RTPTransmitter::GetTransmissionInfo(), and rtptrans.

675 {
676  if (!created)
677  return 0;
678  return rtptrans->GetTransmissionInfo();
679 }
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual RTPTransmissionInfo * GetTransmissionInfo()=0
+ Here is the call graph for this function:

◆ GotoFirstSource()

bool qrtplib::RTPSession::GotoFirstSource ( )

Starts the iteration over the participants by going to the first member in the table. Starts the iteration over the participants by going to the first member in the table. If a member was found, the function returns true, otherwise it returns false.

Definition at line 706 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoFirstSource(), and sources.

707 {
708  if (!created)
709  return false;
710  return sources.GotoFirstSource();
711 }
RTPSessionSources sources
Definition: rtpsession.h:571
+ Here is the call graph for this function:

◆ GotoFirstSourceWithData()

bool qrtplib::RTPSession::GotoFirstSourceWithData ( )

Sets the current source to be the first source in the table which has RTPPacket instances that we haven't extracted yet. Sets the current source to be the first source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

Definition at line 727 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoFirstSourceWithData(), and sources.

728 {
729  if (!created)
730  return false;
732 }
RTPSessionSources sources
Definition: rtpsession.h:571
bool GotoFirstSourceWithData()
Definition: rtpsources.cpp:552
+ Here is the call graph for this function:

◆ GotoNextSource()

bool qrtplib::RTPSession::GotoNextSource ( )

Sets the current source to be the next source in the table. Sets the current source to be the next source in the table. If we're already at the last source, the function returns false, otherwise it returns true.

Definition at line 713 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoNextSource(), and sources.

714 {
715  if (!created)
716  return false;
717  return sources.GotoNextSource();
718 }
RTPSessionSources sources
Definition: rtpsession.h:571
+ Here is the call graph for this function:

◆ GotoNextSourceWithData()

bool qrtplib::RTPSession::GotoNextSourceWithData ( )

Sets the current source to be the next source in the table which has RTPPacket instances that we haven't extracted yet. Sets the current source to be the next source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

Definition at line 734 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoNextSourceWithData(), and sources.

735 {
736  if (!created)
737  return false;
739 }
RTPSessionSources sources
Definition: rtpsession.h:571
bool GotoNextSourceWithData()
Definition: rtpsources.cpp:571
+ Here is the call graph for this function:

◆ GotoPreviousSource()

bool qrtplib::RTPSession::GotoPreviousSource ( )

Sets the current source to be the previous source in the table. Sets the current source to be the previous source in the table. If we're at the first source, the function returns false, otherwise it returns true.

Definition at line 720 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoPreviousSource(), and sources.

721 {
722  if (!created)
723  return false;
724  return sources.GotoPreviousSource();
725 }
RTPSessionSources sources
Definition: rtpsession.h:571
+ Here is the call graph for this function:

◆ GotoPreviousSourceWithData()

bool qrtplib::RTPSession::GotoPreviousSourceWithData ( )

Sets the current source to be the previous source in the table which has RTPPacket instances that we haven't extracted yet. Sets the current source to be the previous source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

Definition at line 741 of file rtpsession.cpp.

References created, qrtplib::RTPSources::GotoPreviousSourceWithData(), and sources.

742 {
743  if (!created)
744  return false;
746 }
RTPSessionSources sources
Definition: rtpsession.h:571
bool GotoPreviousSourceWithData()
Definition: rtpsources.cpp:590
+ Here is the call graph for this function:

◆ IncrementTimestamp()

int qrtplib::RTPSession::IncrementTimestamp ( uint32_t  inc)

This function increments the timestamp with the amount given by inc. This function increments the timestamp with the amount given by inc. This can be useful if, for example, a packet was not sent because it contained only silence. Then, this function should be called to increment the timestamp with the appropriate amount so that the next packets will still be played at the correct time at other hosts.

Definition at line 641 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::IncrementTimestamp(), and packetbuilder.

642 {
643  if (!created)
645 
646  int status;
647 
648  status = packetbuilder.IncrementTimestamp(inc);
649  return status;
650 }
int IncrementTimestamp(uint32_t inc)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:

◆ IncrementTimestampDefault()

int qrtplib::RTPSession::IncrementTimestampDefault ( )

This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement member function. This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement member function. This can be useful if, for example, a packet was not sent because it contained only silence. Then, this function should be called to increment the timestamp with the appropriate amount so that the next packets will still be played at the correct time at other hosts.

Definition at line 652 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::IncrementTimestampDefault(), and packetbuilder.

653 {
654  if (!created)
656 
657  int status;
658 
660  return status;
661 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:

◆ InternalCreate()

int qrtplib::RTPSession::InternalCreate ( const RTPSessionParams sessparams)
private

Definition at line 171 of file rtpsession.cpp.

References qrtplib::RTPSessionParams::AcceptOwnPackets(), acceptownpackets, qrtplib::RTPPacketBuilder::AdjustSSRC(), byemultiplier, qrtplib::RTPSources::Clear(), collisionmultiplier, controlfragment, CreateCNAME(), created, qrtplib::RTPSources::CreateOwnSSRC(), deletetransmitter, qrtplib::RTPPacketBuilder::Destroy(), qrtplib::RTCPPacketBuilder::Destroy(), qrtplib::RTPSessionParams::GetBYETimeoutMultiplier(), qrtplib::RTPSessionParams::GetCNAME(), qrtplib::RTPSessionParams::GetCollisionTimeoutMultiplier(), qrtplib::RTPSessionParams::GetControlTrafficFraction(), qrtplib::RTPTransmitter::GetHeaderOverhead(), qrtplib::RTPSessionParams::GetMinimumRTCPTransmissionInterval(), qrtplib::RTPSessionParams::GetNoteTimeoutMultiplier(), qrtplib::RTPSessionParams::GetOwnTimestampUnit(), qrtplib::RTPSessionParams::GetPredefinedSSRC(), qrtplib::RTPSessionParams::GetReceiveMode(), qrtplib::RTPSessionParams::GetRequestImmediateBYE(), qrtplib::RTPSessionParams::GetResolveLocalHostname(), qrtplib::RTPSessionParams::GetSenderControlBandwidthFraction(), qrtplib::RTPSessionParams::GetSenderTimeoutMultiplier(), qrtplib::RTPSessionParams::GetSessionBandwidth(), qrtplib::RTPSessionParams::GetSourceTimeoutMultiplier(), qrtplib::RTPPacketBuilder::GetSSRC(), qrtplib::RTPSessionParams::GetUseHalfRTCPIntervalAtStartup(), qrtplib::RTPSessionParams::GetUsePredefinedSSRC(), qrtplib::RTPPacketBuilder::Init(), qrtplib::RTCPPacketBuilder::Init(), maxpacksize, membermultiplier, notemultiplier, packetbuilder, qrtplib::RTCPScheduler::Reset(), rtcpbuilder, rtcpsched, rtptrans, sendermultiplier, sessionbandwidth, qrtplib::RTCPScheduler::SetHeaderOverhead(), qrtplib::RTCPSchedulerParams::SetMinimumTransmissionInterval(), qrtplib::RTCPScheduler::SetParameters(), qrtplib::RTPTransmitter::SetReceiveMode(), qrtplib::RTCPSchedulerParams::SetRequestImmediateBYE(), qrtplib::RTCPSchedulerParams::SetRTCPBandwidth(), qrtplib::RTCPSchedulerParams::SetSenderBandwidthFraction(), qrtplib::RTCPSchedulerParams::SetUseHalfAtStartup(), and sources.

Referenced by Create().

172 {
173  int status;
174 
175  // Initialize packet builder
176 
177  if ((status = packetbuilder.Init(maxpacksize)) < 0)
178  {
179  if (deletetransmitter)
180  delete rtptrans;
181  return status;
182  }
183 
184  if (sessparams.GetUsePredefinedSSRC())
185  packetbuilder.AdjustSSRC(sessparams.GetPredefinedSSRC());
186 
187  // Add our own ssrc to the source table
188 
189  if ((status = sources.CreateOwnSSRC(packetbuilder.GetSSRC())) < 0)
190  {
192  if (deletetransmitter)
193  delete rtptrans;
194  return status;
195  }
196 
197  // Set the initial receive mode
198 
199  if ((status = rtptrans->SetReceiveMode(sessparams.GetReceiveMode())) < 0)
200  {
202  sources.Clear();
203  if (deletetransmitter)
204  delete rtptrans;
205  return status;
206  }
207 
208  // Init the RTCP packet builder
209 
210  double timestampunit = sessparams.GetOwnTimestampUnit();
211  uint8_t buf[1024] = {0};
212  std::size_t buflen = 1024;
213  std::string forcedcname = sessparams.GetCNAME();
214 
215  if (forcedcname.length() == 0)
216  {
217  if ((status = CreateCNAME(buf, &buflen, sessparams.GetResolveLocalHostname())) < 0)
218  {
220  sources.Clear();
221  if (deletetransmitter)
222  delete rtptrans;
223  return status;
224  }
225  }
226  else
227  {
228  strncpy((char * )buf, forcedcname.c_str(), buflen);
229  buf[buflen - 1] = 0;
230  buflen = strlen((char *) buf);
231  }
232 
233  if ((status = rtcpbuilder.Init(maxpacksize, timestampunit, buf, buflen)) < 0)
234  {
236  sources.Clear();
237  if (deletetransmitter)
238  delete rtptrans;
239  return status;
240  }
241 
242  // Set scheduler parameters
243 
244  rtcpsched.Reset();
246 
247  RTCPSchedulerParams schedparams;
248 
249  sessionbandwidth = sessparams.GetSessionBandwidth();
250  controlfragment = sessparams.GetControlTrafficFraction();
251 
252  if ((status = schedparams.SetRTCPBandwidth(sessionbandwidth * controlfragment)) < 0)
253  {
254  if (deletetransmitter)
255  delete rtptrans;
257  sources.Clear();
259  return status;
260  }
261  if ((status = schedparams.SetSenderBandwidthFraction(sessparams.GetSenderControlBandwidthFraction())) < 0)
262  {
263  if (deletetransmitter)
264  delete rtptrans;
266  sources.Clear();
268  return status;
269  }
270  if ((status = schedparams.SetMinimumTransmissionInterval(sessparams.GetMinimumRTCPTransmissionInterval())) < 0)
271  {
272  if (deletetransmitter)
273  delete rtptrans;
275  sources.Clear();
277  return status;
278  }
279  schedparams.SetUseHalfAtStartup(sessparams.GetUseHalfRTCPIntervalAtStartup());
280  schedparams.SetRequestImmediateBYE(sessparams.GetRequestImmediateBYE());
281 
282  rtcpsched.SetParameters(schedparams);
283 
284  // copy other parameters
285 
286  acceptownpackets = sessparams.AcceptOwnPackets();
287  membermultiplier = sessparams.GetSourceTimeoutMultiplier();
288  sendermultiplier = sessparams.GetSenderTimeoutMultiplier();
289  byemultiplier = sessparams.GetBYETimeoutMultiplier();
290  collisionmultiplier = sessparams.GetCollisionTimeoutMultiplier();
291  notemultiplier = sessparams.GetNoteTimeoutMultiplier();
292 
293  // Do thread stuff if necessary
294 
295  created = true;
296  return 0;
297 }
void SetHeaderOverhead(std::size_t numbytes)
int Init(unsigned int maxpacksize)
int CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
RTPSessionSources sources
Definition: rtpsession.h:571
unsigned char uint8_t
Definition: rtptypes_win.h:42
int CreateOwnSSRC(uint32_t ssrc)
Definition: rtpsources.cpp:87
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
std::size_t maxpacksize
Definition: rtpsession.h:559
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m)=0
void SetParameters(const RTCPSchedulerParams &params)
double collisionmultiplier
Definition: rtpsession.h:565
virtual std::size_t GetHeaderOverhead()=0
int Init(std::size_t maxpacksize, double timestampunit, const void *cname, std::size_t cnamelen)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsActive()

bool qrtplib::RTPSession::IsActive ( )

Returns whether the session has been created or not.

Definition at line 399 of file rtpsession.cpp.

References created.

400 {
401  return created;
402 }

◆ JoinMulticastGroup()

int qrtplib::RTPSession::JoinMulticastGroup ( const RTPAddress addr)

Joins the multicast group specified by addr.

Definition at line 443 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPTransmitter::JoinMulticastGroup(), and rtptrans.

444 {
445  if (!created)
447  return rtptrans->JoinMulticastGroup(addr);
448 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int JoinMulticastGroup(const RTPAddress &addr)=0
+ Here is the call graph for this function:

◆ LeaveMulticastGroup()

int qrtplib::RTPSession::LeaveMulticastGroup ( const RTPAddress addr)

Leaves the multicast group specified by addr.

Definition at line 450 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPTransmitter::LeaveMulticastGroup(), and rtptrans.

451 {
452  if (!created)
454  return rtptrans->LeaveMulticastGroup(addr);
455 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int LeaveMulticastGroup(const RTPAddress &addr)=0
+ Here is the call graph for this function:

◆ NewUserDefinedTransmitter()

RTPTransmitter * qrtplib::RTPSession::NewUserDefinedTransmitter ( )
inlineprotectedvirtual

Allocate a user defined transmitter. In case you specified in the Create function that you want to use a user defined transmitter, you should override this function. The RTPTransmitter instance returned by this function will then be used to send and receive RTP and RTCP packets. Note that when the session is destroyed, this RTPTransmitter instance will be destroyed as well.

Definition at line 583 of file rtpsession.h.

584 {
585  return 0;
586 }

◆ OnAPPPacket()

void qrtplib::RTPSession::OnAPPPacket ( RTCPAPPPacket apppacket,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual

Is called when an RTCP APP packet apppacket has been received at time receivetime from address senderaddress.

Definition at line 611 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnAPPPacket().

612 {
613 }
+ Here is the caller graph for this function:

◆ OnBYEPacket()

void qrtplib::RTPSession::OnBYEPacket ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when a BYE packet has been processed for source srcdat.

Definition at line 639 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnBYEPacket().

640 {
641 }
+ Here is the caller graph for this function:

◆ OnBYETimeout()

void qrtplib::RTPSession::OnBYETimeout ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when participant srcdat is timed after having sent a BYE packet.

Definition at line 608 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnBYETimeout().

609 {
610 }
+ Here is the caller graph for this function:

◆ OnChangeIncomingData()

bool qrtplib::RTPSession::OnChangeIncomingData ( RTPRawPacket rawpack)
inlineprotectedvirtual

By overriding this function, the raw incoming data can be inspected and modified (e.g. for encryption). By overriding this function, the raw incoming data can be inspected and modified (e.g. for encryption). If the function returns false, the packet is discarded.

Definition at line 653 of file rtpsession.h.

Referenced by ProcessPolledData().

654 {
655  return true;
656 }
+ Here is the caller graph for this function:

◆ OnChangeRTPOrRTCPData()

int qrtplib::RTPSession::OnChangeRTPOrRTCPData ( const void *  origdata,
std::size_t  origlen,
bool  isrtp,
void **  senddata,
std::size_t *  sendlen 
)
inlineprotectedvirtual

If RTPSession::SetChangeOutgoingData was sent to true, overriding this you can change the data packet that will actually be sent, for example adding encryption. If RTPSession::SetChangeOutgoingData was sent to true, overriding this you can change the data packet that will actually be sent, for example adding encryption. Note that no memory management will be performed on the senddata pointer you fill in, so if it needs to be deleted at some point you need to take care of this in some way yourself, a good way may be to do this in RTPSession::OnSentRTPOrRTCPData. If senddata is set to 0, no packet will be sent out. This also provides a way to turn off sending RTCP packets if desired.

Definition at line 646 of file rtpsession.h.

References ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED.

Referenced by SendRTCPData(), and SendRTPData().

647 {
649 }
#define ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED
Definition: rtperrors.h:214
+ Here is the caller graph for this function:

◆ OnCNAMECollision()

void qrtplib::RTPSession::OnCNAMECollision ( RTPSourceData srcdat,
const RTPAddress senderaddress,
const uint8_t cname,
std::size_t  cnamelength 
)
inlineprotectedvirtual

Is called when another CNAME was received than the one already present for source srcdat.

Definition at line 596 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnCNAMECollision().

597 {
598 }
+ Here is the caller graph for this function:

◆ OnNewSource()

void qrtplib::RTPSession::OnNewSource ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when a new entry srcdat is added to the source table.

Definition at line 599 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnNewSource().

600 {
601 }
+ Here is the caller graph for this function:

◆ OnNoteTimeout()

void qrtplib::RTPSession::OnNoteTimeout ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when the SDES NOTE item for source srcdat has been timed out.

Definition at line 620 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnNoteTimeout().

621 {
622 }
+ Here is the caller graph for this function:

◆ OnRemoveSource()

void qrtplib::RTPSession::OnRemoveSource ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when the entry srcdat is about to be deleted from the source table.

Definition at line 602 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRemoveSource().

603 {
604 }
+ Here is the caller graph for this function:

◆ OnRTCPCompoundPacket()

void qrtplib::RTPSession::OnRTCPCompoundPacket ( RTCPCompoundPacket pack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual

Is called when an incoming RTCP packet is about to be processed.

Definition at line 590 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTCPCompoundPacket().

591 {
592 }
+ Here is the caller graph for this function:

◆ OnRTCPReceiverReport()

void qrtplib::RTPSession::OnRTCPReceiverReport ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when an RTCP receiver report has been processed for this source.

Definition at line 626 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTCPReceiverReport().

627 {
628 }
+ Here is the caller graph for this function:

◆ OnRTCPSDESItem()

void qrtplib::RTPSession::OnRTCPSDESItem ( RTPSourceData srcdat,
RTCPSDESPacket::ItemType  t,
const void *  itemdata,
std::size_t  itemlength 
)
inlineprotectedvirtual

Is called when a specific SDES item was received for this source.

Definition at line 629 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTCPSDESItem().

630 {
631 }
+ Here is the caller graph for this function:

◆ OnRTCPSDESPrivateItem()

void qrtplib::RTPSession::OnRTCPSDESPrivateItem ( RTPSourceData srcdat,
const void *  prefixdata,
std::size_t  prefixlen,
const void *  valuedata,
std::size_t  valuelen 
)
inlineprotectedvirtual

Is called when a specific SDES item of 'private' type was received for this source.

Definition at line 634 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTCPSDESPrivateItem().

635 {
636 }
+ Here is the caller graph for this function:

◆ OnRTCPSenderReport()

void qrtplib::RTPSession::OnRTCPSenderReport ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when an RTCP sender report has been processed for this source.

Definition at line 623 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTCPSenderReport().

624 {
625 }
+ Here is the caller graph for this function:

◆ OnRTPPacket()

void qrtplib::RTPSession::OnRTPPacket ( RTPPacket pack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual

Is called when an incoming RTP packet is about to be processed. Is called when an incoming RTP packet is about to be processed. This is not a good function to process an RTP packet in, in case you want to avoid iterating over the sources using the GotoFirst/GotoNext functions. In that case, the RTPSession::OnValidatedRTPPacket function should be used.

Definition at line 587 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnRTPPacket().

588 {
589 }
+ Here is the caller graph for this function:

◆ OnSendRTCPCompoundPacket()

void qrtplib::RTPSession::OnSendRTCPCompoundPacket ( RTCPCompoundPacket pack)
inlineprotectedvirtual

Is called when an RTCP compound packet has just been sent (useful to inspect outgoing RTCP data).

Definition at line 642 of file rtpsession.h.

Referenced by BYEDestroy(), and ProcessPolledData().

643 {
644 }
+ Here is the caller graph for this function:

◆ OnSentRTPOrRTCPData()

void qrtplib::RTPSession::OnSentRTPOrRTCPData ( void *  senddata,
std::size_t  sendlen,
bool  isrtp 
)
inlineprotectedvirtual

This function is called when an RTP or RTCP packet was sent, it can be helpful when data was allocated in RTPSession::OnChangeRTPOrRTCPData to deallocate it here.

Definition at line 650 of file rtpsession.h.

Referenced by SendRTCPData(), and SendRTPData().

651 {
652 }
+ Here is the caller graph for this function:

◆ OnSSRCCollision()

void qrtplib::RTPSession::OnSSRCCollision ( RTPSourceData srcdat,
const RTPAddress senderaddress,
bool  isrtp 
)
inlineprotectedvirtual

Is called when an SSRC collision was detected. Is called when an SSRC collision was detected. The instance srcdat is the one present in the table, the address senderaddress is the one that collided with one of the addresses and isrtp indicates against which address of srcdat the check failed.

Definition at line 593 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnSSRCCollision().

594 {
595 }
+ Here is the caller graph for this function:

◆ OnTimeout()

void qrtplib::RTPSession::OnTimeout ( RTPSourceData srcdat)
inlineprotectedvirtual

Is called when participant srcdat is timed out.

Definition at line 605 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnTimeout().

606 {
607 }
+ Here is the caller graph for this function:

◆ OnUnknownPacketFormat()

void qrtplib::RTPSession::OnUnknownPacketFormat ( RTCPPacket rtcppack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual

Is called when an unknown packet format for a known packet type was detected.

Definition at line 617 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnUnknownPacketFormat().

618 {
619 }
+ Here is the caller graph for this function:

◆ OnUnknownPacketType()

void qrtplib::RTPSession::OnUnknownPacketType ( RTCPPacket rtcppack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual

Is called when an unknown RTCP packet type was detected.

Definition at line 614 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnUnknownPacketType().

615 {
616 }
+ Here is the caller graph for this function:

◆ OnValidatedRTPPacket()

void qrtplib::RTPSession::OnValidatedRTPPacket ( RTPSourceData srcdat,
RTPPacket rtppack,
bool  isonprobation,
bool *  ispackethandled 
)
inlineprotectedvirtual

Allows you to use an RTP packet from the specified source directly. Allows you to use an RTP packet from the specified source directly. If ispackethandled is set to true, the packet will no longer be stored in this source's packet list. Note that if you do set this flag, you'll need to deallocate the packet yourself at an appropriate time.

The difference with RTPSession::OnRTPPacket is that that function will always process the RTP packet further and is therefore not really suited to actually do something with the data.

Definition at line 657 of file rtpsession.h.

Referenced by qrtplib::RTPSessionSources::OnValidatedRTPPacket().

658 {
659 }
+ Here is the caller graph for this function:

◆ ProcessPolledData()

int qrtplib::RTPSession::ProcessPolledData ( )
private

Definition at line 994 of file rtpsession.cpp.

References acceptownpackets, qrtplib::RTCPScheduler::AnalyseOutgoing(), qrtplib::RTCPPacketBuilder::BuildBYEPacket(), qrtplib::RTCPPacketBuilder::BuildNextPacket(), byemultiplier, byepackets, qrtplib::RTCPScheduler::CalculateDeterministicInterval(), qrtplib::RTPSessionSources::ClearOwnCollisionFlag(), collisionlist, collisionmultiplier, created, qrtplib::RTPPacketBuilder::CreateNewSSRC(), qrtplib::RTPSources::CreateOwnSSRC(), qrtplib::RTPTime::CurrentTime(), qrtplib::RTPSources::DeleteOwnSSRC(), qrtplib::RTPSessionSources::DetectedOwnCollision(), qrtplib::RTCPCompoundPacket::GetCompoundPacketData(), qrtplib::RTCPCompoundPacket::GetCompoundPacketLength(), qrtplib::RTPTime::GetDouble(), qrtplib::RTPTransmitter::GetNextPacket(), qrtplib::RTPRawPacket::GetReceiveTime(), qrtplib::RTPRawPacket::GetSenderAddress(), qrtplib::RTCPScheduler::IsTime(), m_changeIncomingData, membermultiplier, qrtplib::RTPSources::MultipleTimeouts(), notemultiplier, OnChangeIncomingData(), OnSendRTCPCompoundPacket(), packetbuilder, qrtplib::RTPSources::ProcessRawPacket(), rtcpbuilder, rtcpsched, rtptrans, qrtplib::RTCPScheduler::ScheduleBYEPacket(), sendermultiplier, SendRTCPData(), sentpackets, sources, qrtplib::RTPCollisionList::Timeout(), qrtplib::RTPCollisionList::UpdateAddress(), and useSR_BYEifpossible.

995 {
996  RTPRawPacket *rawpack;
997  int status;
998 
999  while ((rawpack = rtptrans->GetNextPacket()) != 0)
1000  {
1002  {
1003  // Provide a way to change incoming data, for decryption for example
1004  if (!OnChangeIncomingData(rawpack))
1005  {
1006  delete rawpack;
1007  continue;
1008  }
1009  }
1010 
1012 
1013  // since our sources instance also uses the scheduler (analysis of incoming packets)
1014  // we'll lock it
1015  if ((status = sources.ProcessRawPacket(rawpack, rtptrans, acceptownpackets)) < 0)
1016  {
1017  delete rawpack;
1018  return status;
1019  }
1020 
1021  if (sources.DetectedOwnCollision()) // collision handling!
1022  {
1023  bool created;
1024 
1025  if ((status = collisionlist.UpdateAddress(&rawpack->GetSenderAddress(), rawpack->GetReceiveTime(), &created)) < 0)
1026  {
1027  delete rawpack;
1028  return status;
1029  }
1030 
1031  if (created) // first time we've encountered this address, send bye packet and
1032  { // change our own SSRC
1033  bool hassentpackets = sentpackets;
1034 
1035  if (hassentpackets)
1036  {
1037  // Only send BYE packet if we've actually sent data using this
1038  // SSRC
1039 
1040  RTCPCompoundPacket *rtcpcomppack;
1041 
1042  if ((status = rtcpbuilder.BuildBYEPacket(&rtcpcomppack, 0, 0, useSR_BYEifpossible)) < 0)
1043  {
1044  delete rawpack;
1045  return status;
1046  }
1047 
1048  byepackets.push_back(rtcpcomppack);
1049  if (byepackets.size() == 1) // was the first packet, schedule a BYE packet (otherwise there's already one scheduled)
1050  {
1051  rtcpsched.ScheduleBYEPacket(rtcpcomppack->GetCompoundPacketLength());
1052  }
1053  }
1054  // bye packet is built and scheduled, now change our SSRC
1055  // and reset the packet count in the transmitter
1056 
1058 
1059  sentpackets = false;
1060 
1061  // remove old entry in source table and add new one
1062 
1063  if ((status = sources.DeleteOwnSSRC()) < 0)
1064  {
1065  delete rawpack;
1066  return status;
1067  }
1068  if ((status = sources.CreateOwnSSRC(newssrc)) < 0)
1069  {
1070  delete rawpack;
1071  return status;
1072  }
1073  }
1074  }
1075  delete rawpack;
1076  }
1077 
1078  RTPTime d = rtcpsched.CalculateDeterministicInterval(false);
1079 
1080  RTPTime t = RTPTime::CurrentTime();
1081  double Td = d.GetDouble();
1082  RTPTime sendertimeout = RTPTime(Td * sendermultiplier);
1083  RTPTime generaltimeout = RTPTime(Td * membermultiplier);
1084  RTPTime byetimeout = RTPTime(Td * byemultiplier);
1085  RTPTime colltimeout = RTPTime(Td * collisionmultiplier);
1086  RTPTime notetimeout = RTPTime(Td * notemultiplier);
1087 
1088  sources.MultipleTimeouts(t, sendertimeout, byetimeout, generaltimeout, notetimeout);
1089  collisionlist.Timeout(t, colltimeout);
1090 
1091  // We'll check if it's time for RTCP stuff
1092 
1093  bool istime = rtcpsched.IsTime();
1094 
1095  if (istime)
1096  {
1097  RTCPCompoundPacket *pack;
1098 
1099  // we'll check if there's a bye packet to send, or just a normal packet
1100 
1101  if (byepackets.empty())
1102  {
1103  if ((status = rtcpbuilder.BuildNextPacket(&pack)) < 0)
1104  {
1105  return status;
1106  }
1107  if ((status = SendRTCPData(pack->GetCompoundPacketData(), pack->GetCompoundPacketLength())) < 0)
1108  {
1109  delete pack;
1110  return status;
1111  }
1112 
1113  sentpackets = true;
1114 
1115  OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
1116  }
1117  else
1118  {
1119  pack = *(byepackets.begin());
1120  byepackets.pop_front();
1121 
1122  if ((status = SendRTCPData(pack->GetCompoundPacketData(), pack->GetCompoundPacketLength())) < 0)
1123  {
1124  delete pack;
1125  return status;
1126  }
1127 
1128  sentpackets = true;
1129 
1130  OnSendRTCPCompoundPacket(pack); // we'll place this after the actual send to avoid tampering
1131 
1132  if (!byepackets.empty()) // more bye packets to send, schedule them
1133  {
1134  rtcpsched.ScheduleBYEPacket((*(byepackets.begin()))->GetCompoundPacketLength());
1135  }
1136  }
1137 
1138  rtcpsched.AnalyseOutgoing(*pack);
1139 
1140  delete pack;
1141  }
1142  return 0;
1143 }
virtual RTPRawPacket * GetNextPacket()=0
int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible=true)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
void MultipleTimeouts(const RTPTime &curtime, const RTPTime &sendertimeout, const RTPTime &byetimeout, const RTPTime &generaltimeout, const RTPTime &notetimeout)
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
void ScheduleBYEPacket(std::size_t packetsize)
RTPSessionSources sources
Definition: rtpsession.h:571
unsigned int uint32_t
Definition: rtptypes_win.h:46
int ProcessRawPacket(RTPRawPacket *rawpack, RTPTransmitter *trans, bool acceptownpackets)
Definition: rtpsources.cpp:149
int BuildNextPacket(RTCPCompoundPacket **pack)
int SendRTCPData(const void *data, std::size_t len)
RTPCollisionList collisionlist
Definition: rtpsession.h:575
int UpdateAddress(const RTPAddress *addr, const RTPTime &receivetime, bool *created)
int CreateOwnSSRC(uint32_t ssrc)
Definition: rtpsources.cpp:87
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
void Timeout(const RTPTime &currenttime, const RTPTime &timeoutdelay)
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
virtual bool OnChangeIncomingData(RTPRawPacket *rawpack)
Definition: rtpsession.h:653
std::list< RTCPCompoundPacket * > byepackets
Definition: rtpsession.h:577
double collisionmultiplier
Definition: rtpsession.h:565
static RTPTime CurrentTime()
void AnalyseOutgoing(RTCPCompoundPacket &rtcpcomppack)
virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack)
Definition: rtpsession.h:642
RTPTime CalculateDeterministicInterval(bool sender=false)
+ Here is the call graph for this function:

◆ ProcessRTCPCompoundPacket()

int qrtplib::RTPSession::ProcessRTCPCompoundPacket ( RTCPCompoundPacket rtcpcomppack,
RTPRawPacket pack 
)
private

◆ SendPacket() [1/2]

int qrtplib::RTPSession::SendPacket ( const void *  data,
std::size_t  len 
)

Sends the RTP packet with payload data which has length len. Sends the RTP packet with payload data which has length len. The used payload type, marker and timestamp increment will be those that have been set using the SetDefault member functions.

Definition at line 457 of file rtpsession.cpp.

References qrtplib::RTPPacketBuilder::BuildPacket(), created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::GetPacket(), qrtplib::RTPPacketBuilder::GetPacketLength(), packetbuilder, SendRTPData(), sentpackets, qrtplib::RTPSources::SentRTPPacket(), and sources.

Referenced by RTPSink::write().

458 {
459  int status;
460 
461  if (!created)
463 
464  if ((status = packetbuilder.BuildPacket(data, len)) < 0)
465  {
466  return status;
467  }
469  {
470  return status;
471  }
472 
474  sentpackets = true;
475  return 0;
476 }
int SendRTPData(const void *data, std::size_t len)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPSessionSources sources
Definition: rtpsession.h:571
int BuildPacket(const void *data, unsigned int len)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPacket() [2/2]

int qrtplib::RTPSession::SendPacket ( const void *  data,
std::size_t  len,
uint8_t  pt,
bool  mark,
uint32_t  timestampinc 
)

Sends the RTP packet with payload data which has length len. It will use payload type pt, marker mark and after the packet has been built, the timestamp will be incremented by timestampinc.

Definition at line 478 of file rtpsession.cpp.

References qrtplib::RTPPacketBuilder::BuildPacket(), created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::GetPacket(), qrtplib::RTPPacketBuilder::GetPacketLength(), packetbuilder, SendRTPData(), sentpackets, qrtplib::RTPSources::SentRTPPacket(), and sources.

479 {
480  int status;
481 
482  if (!created)
484 
485  if ((status = packetbuilder.BuildPacket(data, len, pt, mark, timestampinc)) < 0)
486  {
487  return status;
488  }
490  {
491  return status;
492  }
493 
495  sentpackets = true;
496  return 0;
497 }
int SendRTPData(const void *data, std::size_t len)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPSessionSources sources
Definition: rtpsession.h:571
int BuildPacket(const void *data, unsigned int len)
+ Here is the call graph for this function:

◆ SendPacketEx() [1/2]

int qrtplib::RTPSession::SendPacketEx ( const void *  data,
std::size_t  len,
uint16_t  hdrextID,
const void *  hdrextdata,
std::size_t  numhdrextwords 
)

Sends the RTP packet with payload data which has length len. The packet will contain a header extension with identifier hdrextID and containing data hdrextdata. The length of this data is given by numhdrextwords and is specified in a number of 32-bit words. The used payload type, marker and timestamp increment will be those that have been set using the SetDefault member functions.

Definition at line 499 of file rtpsession.cpp.

References qrtplib::RTPPacketBuilder::BuildPacketEx(), created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::GetPacket(), qrtplib::RTPPacketBuilder::GetPacketLength(), packetbuilder, SendRTPData(), sentpackets, qrtplib::RTPSources::SentRTPPacket(), and sources.

500 {
501  int status;
502 
503  if (!created)
505 
506  if ((status = packetbuilder.BuildPacketEx(data, len, hdrextID, hdrextdata, numhdrextwords)) < 0)
507  {
508  return status;
509  }
511  {
512  return status;
513  }
514 
516  sentpackets = true;
517  return 0;
518 }
int SendRTPData(const void *data, std::size_t len)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPSessionSources sources
Definition: rtpsession.h:571
int BuildPacketEx(const void *data, unsigned int len, uint16_t hdrextID, const void *hdrextdata, unsigned int numhdrextwords)
+ Here is the call graph for this function:

◆ SendPacketEx() [2/2]

int qrtplib::RTPSession::SendPacketEx ( const void *  data,
std::size_t  len,
uint8_t  pt,
bool  mark,
uint32_t  timestampinc,
uint16_t  hdrextID,
const void *  hdrextdata,
std::size_t  numhdrextwords 
)

Sends the RTP packet with payload data which has length len. It will use payload type pt, marker mark and after the packet has been built, the timestamp will be incremented by timestampinc. The packet will contain a header extension with identifier hdrextID and containing data hdrextdata. The length of this data is given by numhdrextwords and is specified in a number of 32-bit words.

Definition at line 520 of file rtpsession.cpp.

References qrtplib::RTPPacketBuilder::BuildPacketEx(), created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTPPacketBuilder::GetPacket(), qrtplib::RTPPacketBuilder::GetPacketLength(), packetbuilder, SendRTPData(), sentpackets, qrtplib::RTPSources::SentRTPPacket(), and sources.

521 {
522  int status;
523 
524  if (!created)
526 
527  if ((status = packetbuilder.BuildPacketEx(data, len, pt, mark, timestampinc, hdrextID, hdrextdata, numhdrextwords)) < 0)
528  {
529  return status;
530  }
532  {
533  return status;
534  }
535 
537  sentpackets = true;
538  return 0;
539 }
int SendRTPData(const void *data, std::size_t len)
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPSessionSources sources
Definition: rtpsession.h:571
int BuildPacketEx(const void *data, unsigned int len, uint16_t hdrextID, const void *hdrextdata, unsigned int numhdrextwords)
+ Here is the call graph for this function:

◆ SendRawData()

int qrtplib::RTPSession::SendRawData ( const void *  data,
std::size_t  len,
bool  usertpchannel 
)

With this function raw data can be sent directly over the RTP or RTCP channel (if they are different); the data is not passed through the RTPSession::OnChangeRTPOrRTCPData function.

Definition at line 594 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtptrans, qrtplib::RTPTransmitter::SendRTCPData(), and qrtplib::RTPTransmitter::SendRTPData().

595 {
596  if (!created)
598 
599  int status;
600 
601  if (usertpchannel)
602  status = rtptrans->SendRTPData(data, len);
603  else
604  status = rtptrans->SendRTCPData(data, len);
605  return status;
606 }
virtual int SendRTPData(const void *data, std::size_t len)=0
virtual int SendRTCPData(const void *data, std::size_t len)=0
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
+ Here is the call graph for this function:

◆ SendRTCPAPPPacket()

int qrtplib::RTPSession::SendRTCPAPPPacket ( uint8_t  subtype,
const uint8_t  name[4],
const void *  appdata,
std::size_t  appdatalen 
)

If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet containing an RTCP APP packet and sends it immediately. If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet containing an RTCP APP packet and sends it immediately. If successful, the function returns the number of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP specification, so use with care.

Definition at line 543 of file rtpsession.cpp.

References qrtplib::RTCPCompoundPacketBuilder::AddAPPPacket(), qrtplib::RTCPCompoundPacketBuilder::AddSDESNormalItem(), qrtplib::RTCPCompoundPacketBuilder::AddSDESSource(), qrtplib::RTCPSDESPacket::CNAME, created, qrtplib::RTCPCompoundPacketBuilder::EndBuild(), ERR_RTP_SESSION_NOTCREATED, qrtplib::RTCPCompoundPacket::GetCompoundPacketData(), qrtplib::RTCPCompoundPacket::GetCompoundPacketLength(), qrtplib::RTCPPacketBuilder::GetLocalCNAME(), qrtplib::RTPPacketBuilder::GetSSRC(), qrtplib::RTCPCompoundPacketBuilder::InitBuild(), maxpacksize, packetbuilder, rtcpbuilder, SendRTCPData(), sentpackets, and qrtplib::RTCPCompoundPacketBuilder::StartReceiverReport().

544 {
545  int status;
546 
547  if (!created)
549 
550  uint32_t ssrc = packetbuilder.GetSSRC();
551 
552  RTCPCompoundPacketBuilder pb;
553 
554  status = pb.InitBuild(maxpacksize);
555 
556  if (status < 0)
557  return status;
558 
559  //first packet in an rtcp compound packet should always be SR or RR
560  if ((status = pb.StartReceiverReport(ssrc)) < 0)
561  return status;
562 
563  //add SDES packet with CNAME item
564  if ((status = pb.AddSDESSource(ssrc)) < 0)
565  return status;
566 
567  std::size_t owncnamelen = 0;
568  uint8_t *owncname = rtcpbuilder.GetLocalCNAME(&owncnamelen);
569 
570  if ((status = pb.AddSDESNormalItem(RTCPSDESPacket::CNAME, owncname, owncnamelen)) < 0)
571  {
572  return status;
573  }
574 
575  //add our application specific packet
576  if ((status = pb.AddAPPPacket(subtype, ssrc, name, appdata, appdatalen)) < 0)
577  return status;
578 
579  if ((status = pb.EndBuild()) < 0)
580  return status;
581 
582  //send packet
583  status = SendRTCPData(pb.GetCompoundPacketData(), pb.GetCompoundPacketLength());
584  if (status < 0)
585  return status;
586 
587  sentpackets = true;
588 
589  return pb.GetCompoundPacketLength();
590 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
unsigned int uint32_t
Definition: rtptypes_win.h:46
int SendRTCPData(const void *data, std::size_t len)
unsigned char uint8_t
Definition: rtptypes_win.h:42
std::size_t maxpacksize
Definition: rtpsession.h:559
uint8_t * GetLocalCNAME(std::size_t *len) const
+ Here is the call graph for this function:

◆ SendRTCPData()

int qrtplib::RTPSession::SendRTCPData ( const void *  data,
std::size_t  len 
)
private

Definition at line 1209 of file rtpsession.cpp.

References m_changeOutgoingData, OnChangeRTPOrRTCPData(), OnSentRTPOrRTCPData(), rtptrans, and qrtplib::RTPTransmitter::SendRTCPData().

Referenced by BYEDestroy(), ProcessPolledData(), and SendRTCPAPPPacket().

1210 {
1211  if (!m_changeOutgoingData)
1212  return rtptrans->SendRTCPData(data, len);
1213 
1214  void *pSendData = 0;
1215  std::size_t sendLen = 0;
1216  int status = 0;
1217 
1218  status = OnChangeRTPOrRTCPData(data, len, false, &pSendData, &sendLen);
1219  if (status < 0)
1220  return status;
1221 
1222  if (pSendData)
1223  {
1224  status = rtptrans->SendRTCPData(pSendData, sendLen);
1225  OnSentRTPOrRTCPData(pSendData, sendLen, false);
1226  }
1227 
1228  return status;
1229 }
virtual int SendRTCPData(const void *data, std::size_t len)=0
virtual void OnSentRTPOrRTCPData(void *senddata, std::size_t sendlen, bool isrtp)
Definition: rtpsession.h:650
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int OnChangeRTPOrRTCPData(const void *origdata, std::size_t origlen, bool isrtp, void **senddata, std::size_t *sendlen)
Definition: rtpsession.h:646
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendRTPData()

int qrtplib::RTPSession::SendRTPData ( const void *  data,
std::size_t  len 
)
private

Definition at line 1187 of file rtpsession.cpp.

References m_changeOutgoingData, OnChangeRTPOrRTCPData(), OnSentRTPOrRTCPData(), rtptrans, and qrtplib::RTPTransmitter::SendRTPData().

Referenced by SendPacket(), and SendPacketEx().

1188 {
1189  if (!m_changeOutgoingData)
1190  return rtptrans->SendRTPData(data, len);
1191 
1192  void *pSendData = 0;
1193  std::size_t sendLen = 0;
1194  int status = 0;
1195 
1196  status = OnChangeRTPOrRTCPData(data, len, true, &pSendData, &sendLen);
1197  if (status < 0)
1198  return status;
1199 
1200  if (pSendData)
1201  {
1202  status = rtptrans->SendRTPData(pSendData, sendLen);
1203  OnSentRTPOrRTCPData(pSendData, sendLen, true);
1204  }
1205 
1206  return status;
1207 }
virtual int SendRTPData(const void *data, std::size_t len)=0
virtual void OnSentRTPOrRTCPData(void *senddata, std::size_t sendlen, bool isrtp)
Definition: rtpsession.h:650
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int OnChangeRTPOrRTCPData(const void *origdata, std::size_t origlen, bool isrtp, void **senddata, std::size_t *sendlen)
Definition: rtpsession.h:646
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChangeIncomingData()

void qrtplib::RTPSession::SetChangeIncomingData ( bool  change)
inlineprotected

If this is set to true, incoming data will be passed through RTPSession::OnChangeIncomingData, allowing you to modify the data (e.g. to decrypt it).

Definition at line 501 of file rtpsession.h.

502  {
503  m_changeIncomingData = change;
504  }

◆ SetChangeOutgoingData()

void qrtplib::RTPSession::SetChangeOutgoingData ( bool  change)
inlineprotected

If this is set to true, outgoing data will be passed through RTPSession::OnChangeRTPOrRTCPData and RTPSession::OnSentRTPOrRTCPData, allowing you to modify the data (e.g. to encrypt it).

Definition at line 494 of file rtpsession.h.

495  {
496  m_changeOutgoingData = change;
497  }

◆ SetDefaultMark()

int qrtplib::RTPSession::SetDefaultMark ( bool  m)

Sets the default marker for RTP packets to m.

Definition at line 619 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, packetbuilder, and qrtplib::RTPPacketBuilder::SetDefaultMark().

Referenced by RTPSink::setPayloadInformation().

620 {
621  if (!created)
623 
624  int status;
625 
626  status = packetbuilder.SetDefaultMark(m);
627  return status;
628 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefaultPayloadType()

int qrtplib::RTPSession::SetDefaultPayloadType ( uint8_t  pt)

Sets the default payload type for RTP packets to pt.

Definition at line 608 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, packetbuilder, and qrtplib::RTPPacketBuilder::SetDefaultPayloadType().

Referenced by RTPSink::setPayloadInformation().

609 {
610  if (!created)
612 
613  int status;
614 
616  return status;
617 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetDefaultPayloadType(uint8_t pt)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefaultTimestampIncrement()

int qrtplib::RTPSession::SetDefaultTimestampIncrement ( uint32_t  timestampinc)

Sets the default value to increment the timestamp with to timestampinc.

Definition at line 630 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, packetbuilder, and qrtplib::RTPPacketBuilder::SetDefaultTimestampIncrement().

Referenced by RTPSink::setPayloadInformation().

631 {
632  if (!created)
634 
635  int status;
636 
637  status = packetbuilder.SetDefaultTimestampIncrement(timestampinc);
638  return status;
639 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
int SetDefaultTimestampIncrement(uint32_t timestampinc)
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetEMailInterval()

void qrtplib::RTPSession::SetEMailInterval ( int  count)

Sets the RTCP interval for the SDES e-mail item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES e-mail item will be added after the sources in the source table have been processed count times.

Definition at line 899 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetEMailInterval().

900 {
901  if (!created)
902  return;
904 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
+ Here is the call graph for this function:

◆ SetLocalEMail()

int qrtplib::RTPSession::SetLocalEMail ( const void *  s,
std::size_t  len 
)

Sets the SDES e-mail item for the local participant to the value s with length len.

Definition at line 944 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalEMail().

945 {
946  if (!created)
948 
949  int status;
950  status = rtcpbuilder.SetLocalEMail(s, len);
951  return status;
952 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetLocalEMail(const void *s, std::size_t len)
+ Here is the call graph for this function:

◆ SetLocalLocation()

int qrtplib::RTPSession::SetLocalLocation ( const void *  s,
std::size_t  len 
)

Sets the SDES location item for the local participant to the value s with length len.

Definition at line 954 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalLocation().

955 {
956  if (!created)
958 
959  int status;
960  status = rtcpbuilder.SetLocalLocation(s, len);
961  return status;
962 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetLocalLocation(const void *s, std::size_t len)
+ Here is the call graph for this function:

◆ SetLocalName()

int qrtplib::RTPSession::SetLocalName ( const void *  s,
std::size_t  len 
)

Sets the SDES name item for the local participant to the value s with length len.

Definition at line 934 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalName().

935 {
936  if (!created)
938 
939  int status;
940  status = rtcpbuilder.SetLocalName(s, len);
941  return status;
942 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetLocalName(const void *s, std::size_t len)
+ Here is the call graph for this function:

◆ SetLocalNote()

int qrtplib::RTPSession::SetLocalNote ( const void *  s,
std::size_t  len 
)

Sets the SDES note item for the local participant to the value s with length len.

Definition at line 984 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalNote().

985 {
986  if (!created)
988 
989  int status;
990  status = rtcpbuilder.SetLocalNote(s, len);
991  return status;
992 }
int SetLocalNote(const void *s, std::size_t len)
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:

◆ SetLocalPhone()

int qrtplib::RTPSession::SetLocalPhone ( const void *  s,
std::size_t  len 
)

Sets the SDES phone item for the local participant to the value s with length len.

Definition at line 964 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalPhone().

965 {
966  if (!created)
968 
969  int status;
970  status = rtcpbuilder.SetLocalPhone(s, len);
971  return status;
972 }
int SetLocalPhone(const void *s, std::size_t len)
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:

◆ SetLocalTool()

int qrtplib::RTPSession::SetLocalTool ( const void *  s,
std::size_t  len 
)

Sets the SDES tool item for the local participant to the value s with length len.

Definition at line 974 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocalTool().

975 {
976  if (!created)
978 
979  int status;
980  status = rtcpbuilder.SetLocalTool(s, len);
981  return status;
982 }
int SetLocalTool(const void *s, std::size_t len)
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
+ Here is the call graph for this function:

◆ SetLocationInterval()

void qrtplib::RTPSession::SetLocationInterval ( int  count)

Sets the RTCP interval for the SDES location item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES location item will be added after the sources in the source table have been processed count times.

Definition at line 906 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetLocationInterval().

907 {
908  if (!created)
909  return;
911 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
void SetLocationInterval(int count)
+ Here is the call graph for this function:

◆ SetMaximumPacketSize()

int qrtplib::RTPSession::SetMaximumPacketSize ( std::size_t  s)

Sets the maximum allowed packet size to s.

Definition at line 835 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_MAXPACKETSIZETOOSMALL, ERR_RTP_SESSION_NOTCREATED, maxpacksize, packetbuilder, rtcpbuilder, RTP_MINPACKETSIZE, rtptrans, qrtplib::RTPPacketBuilder::SetMaximumPacketSize(), qrtplib::RTCPPacketBuilder::SetMaximumPacketSize(), and qrtplib::RTPTransmitter::SetMaximumPacketSize().

Referenced by RTPSink::setPayloadInformation().

836 {
837  if (!created)
839 
840  if (s < RTP_MINPACKETSIZE)
842 
843  int status;
844 
845  if ((status = rtptrans->SetMaximumPacketSize(s)) < 0)
846  return status;
847 
848  if ((status = packetbuilder.SetMaximumPacketSize(s)) < 0)
849  {
850  // restore previous max packet size
852  return status;
853  }
854  if ((status = rtcpbuilder.SetMaximumPacketSize(s)) < 0)
855  {
856  // restore previous max packet size
859  return status;
860  }
861  maxpacksize = s;
862  return 0;
863 }
RTPPacketBuilder packetbuilder
Definition: rtpsession.h:572
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_MAXPACKETSIZETOOSMALL
Definition: rtperrors.h:113
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetMaximumPacketSize(std::size_t maxpacksize)
#define RTP_MINPACKETSIZE
Definition: rtpdefines.h:39
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int SetMaximumPacketSize(std::size_t s)=0
std::size_t maxpacksize
Definition: rtpsession.h:559
int SetMaximumPacketSize(unsigned int maxpacksize)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNameInterval()

void qrtplib::RTPSession::SetNameInterval ( int  count)

Sets the RTCP interval for the SDES name item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES name item will be added after the sources in the source table have been processed count times.

Definition at line 892 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetNameInterval().

893 {
894  if (!created)
895  return;
897 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
+ Here is the call graph for this function:

◆ SetNoteInterval()

void qrtplib::RTPSession::SetNoteInterval ( int  count)

Sets the RTCP interval for the SDES note item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES note item will be added after the sources in the source table have been processed count times.

Definition at line 927 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetNoteInterval().

928 {
929  if (!created)
930  return;
932 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
+ Here is the call graph for this function:

◆ SetPhoneInterval()

void qrtplib::RTPSession::SetPhoneInterval ( int  count)

Sets the RTCP interval for the SDES phone item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES phone item will be added after the sources in the source table have been processed count times.

Definition at line 913 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetPhoneInterval().

914 {
915  if (!created)
916  return;
918 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
+ Here is the call graph for this function:

◆ SetPreTransmissionDelay()

int qrtplib::RTPSession::SetPreTransmissionDelay ( const RTPTime delay)

This function allows you to inform the library about the delay between sampling the first sample of a packet and sending the packet. This function allows you to inform the library about the delay between sampling the first sample of a packet and sending the packet. This delay is taken into account when calculating the relation between RTP timestamp and wallclock time, used for inter-media synchronization.

Definition at line 663 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetPreTransmissionDelay().

664 {
665  if (!created)
667 
668  int status;
669 
670  status = rtcpbuilder.SetPreTransmissionDelay(delay);
671  return status;
672 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetPreTransmissionDelay(const RTPTime &delay)
+ Here is the call graph for this function:

◆ SetReceiveMode()

int qrtplib::RTPSession::SetReceiveMode ( RTPTransmitter::ReceiveMode  m)

Sets the receive mode to m. Sets the receive mode to m. Note that when the receive mode is changed, the list of addresses to be ignored ot accepted will be cleared.

Definition at line 786 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtptrans, and qrtplib::RTPTransmitter::SetReceiveMode().

787 {
788  if (!created)
790  return rtptrans->SetReceiveMode(m);
791 }
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m)=0
+ Here is the call graph for this function:

◆ SetSessionBandwidth()

int qrtplib::RTPSession::SetSessionBandwidth ( double  bw)

Sets the session bandwidth to bw, which is specified in bytes per second.

Definition at line 865 of file rtpsession.cpp.

References controlfragment, created, ERR_RTP_SESSION_NOTCREATED, qrtplib::RTCPScheduler::GetParameters(), rtcpsched, sessionbandwidth, qrtplib::RTCPScheduler::SetParameters(), and qrtplib::RTCPSchedulerParams::SetRTCPBandwidth().

866 {
867  if (!created)
869 
870  int status;
871  RTCPSchedulerParams p = rtcpsched.GetParameters();
872  status = p.SetRTCPBandwidth(bw * controlfragment);
873  if (status >= 0)
874  {
876  sessionbandwidth = bw;
877  }
878  return status;
879 }
RTCPSchedulerParams GetParameters() const
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
RTCPScheduler rtcpsched
Definition: rtpsession.h:573
void SetParameters(const RTCPSchedulerParams &params)
+ Here is the call graph for this function:

◆ SetTimestampUnit()

int qrtplib::RTPSession::SetTimestampUnit ( double  u)

Sets the timestamp unit for our own data. Sets the timestamp unit for our own data. The timestamp unit is defined as a time interval in seconds divided by the corresponding timestamp interval. For example, for 8000 Hz audio, the timestamp unit would typically be 1/8000. Since this value is initially set to an illegal value, the user must set this to an allowed value to be able to create a session.

Definition at line 881 of file rtpsession.cpp.

References created, ERR_RTP_SESSION_NOTCREATED, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetTimestampUnit().

Referenced by RTPSink::setPayloadInformation().

882 {
883  if (!created)
885 
886  int status;
887 
888  status = rtcpbuilder.SetTimestampUnit(u);
889  return status;
890 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
#define ERR_RTP_SESSION_NOTCREATED
Definition: rtperrors.h:114
int SetTimestampUnit(double tsunit)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetToolInterval()

void qrtplib::RTPSession::SetToolInterval ( int  count)

Sets the RTCP interval for the SDES tool item. After all possible sources in the source table have been processed, the class will check if other SDES items need to be sent. If count is zero or negative, nothing will happen. If count is positive, an SDES tool item will be added after the sources in the source table have been processed count times.

Definition at line 920 of file rtpsession.cpp.

References created, rtcpbuilder, and qrtplib::RTCPPacketBuilder::SetToolInterval().

921 {
922  if (!created)
923  return;
925 }
RTCPPacketBuilder rtcpbuilder
Definition: rtpsession.h:574
+ Here is the call graph for this function:

◆ SupportsMulticasting()

bool qrtplib::RTPSession::SupportsMulticasting ( )

Returns true if multicasting is supported.

Definition at line 436 of file rtpsession.cpp.

References created, rtptrans, and qrtplib::RTPTransmitter::SupportsMulticasting().

437 {
438  if (!created)
439  return false;
440  return rtptrans->SupportsMulticasting();
441 }
RTPTransmitter * rtptrans
Definition: rtpsession.h:553
virtual bool SupportsMulticasting()=0
+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ RTCPSessionPacketBuilder

friend class RTCPSessionPacketBuilder
friend

Definition at line 580 of file rtpsession.h.

◆ RTPSessionSources

friend class RTPSessionSources
friend

Definition at line 579 of file rtpsession.h.

Member Data Documentation

◆ acceptownpackets

bool qrtplib::RTPSession::acceptownpackets
private

Definition at line 557 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ byemultiplier

double qrtplib::RTPSession::byemultiplier
private

Definition at line 563 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ byepackets

std::list<RTCPCompoundPacket *> qrtplib::RTPSession::byepackets
private

Definition at line 577 of file rtpsession.h.

Referenced by BYEDestroy(), Destroy(), and ProcessPolledData().

◆ collisionlist

RTPCollisionList qrtplib::RTPSession::collisionlist
private

Definition at line 575 of file rtpsession.h.

Referenced by BYEDestroy(), Destroy(), and ProcessPolledData().

◆ collisionmultiplier

double qrtplib::RTPSession::collisionmultiplier
private

Definition at line 565 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ controlfragment

double qrtplib::RTPSession::controlfragment
private

Definition at line 561 of file rtpsession.h.

Referenced by InternalCreate(), and SetSessionBandwidth().

◆ created

bool qrtplib::RTPSession::created
private

◆ deletertprnd

bool qrtplib::RTPSession::deletertprnd
private

Definition at line 551 of file rtpsession.h.

Referenced by GetRandomNumberGenerator(), and ~RTPSession().

◆ deletetransmitter

bool qrtplib::RTPSession::deletetransmitter
private

Definition at line 555 of file rtpsession.h.

Referenced by BYEDestroy(), Create(), Destroy(), and InternalCreate().

◆ m_changeIncomingData

bool qrtplib::RTPSession::m_changeIncomingData
private

Definition at line 569 of file rtpsession.h.

Referenced by ProcessPolledData(), and RTPSession().

◆ m_changeOutgoingData

bool qrtplib::RTPSession::m_changeOutgoingData
private

Definition at line 569 of file rtpsession.h.

Referenced by RTPSession(), SendRTCPData(), and SendRTPData().

◆ maxpacksize

std::size_t qrtplib::RTPSession::maxpacksize
private

Definition at line 559 of file rtpsession.h.

Referenced by Create(), InternalCreate(), SendRTCPAPPPacket(), and SetMaximumPacketSize().

◆ membermultiplier

double qrtplib::RTPSession::membermultiplier
private

Definition at line 564 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ notemultiplier

double qrtplib::RTPSession::notemultiplier
private

Definition at line 566 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ packetbuilder

RTPPacketBuilder qrtplib::RTPSession::packetbuilder
private

◆ rtcpbuilder

RTCPPacketBuilder qrtplib::RTPSession::rtcpbuilder
private

◆ rtcpsched

RTCPScheduler qrtplib::RTPSession::rtcpsched
private

◆ rtprnd

RTPRandom* qrtplib::RTPSession::rtprnd
private

Definition at line 550 of file rtpsession.h.

Referenced by ~RTPSession().

◆ rtptrans

RTPTransmitter* qrtplib::RTPSession::rtptrans
private

◆ sendermultiplier

double qrtplib::RTPSession::sendermultiplier
private

Definition at line 562 of file rtpsession.h.

Referenced by InternalCreate(), and ProcessPolledData().

◆ sentpackets

bool qrtplib::RTPSession::sentpackets
private

◆ sessionbandwidth

double qrtplib::RTPSession::sessionbandwidth
private

Definition at line 560 of file rtpsession.h.

Referenced by InternalCreate(), and SetSessionBandwidth().

◆ sources

RTPSessionSources qrtplib::RTPSession::sources
private

◆ useSR_BYEifpossible

bool qrtplib::RTPSession::useSR_BYEifpossible
private

Definition at line 558 of file rtpsession.h.

Referenced by BYEDestroy(), Create(), and ProcessPolledData().

◆ usingpollthread

bool qrtplib::RTPSession::usingpollthread
private

Definition at line 556 of file rtpsession.h.

Referenced by Create(), and GetRTCPDelay().


The documentation for this class was generated from the following files: