41 #include "rtpconfig.h"
54 #ifdef RTP_SUPPORT_THREAD
55 #include <jthread/jmutex.h>
56 #endif // RTP_SUPPORT_THREAD
62 class RTPSessionParams;
63 class RTPTransmissionParams;
68 class RTPTransmissionInfo;
69 class RTCPCompoundPacket;
119 void BYEDestroy(
const RTPTime &maxwaittime,
const void *reason,
size_t reasonlength);
160 uint8_t pt,
bool mark,uint32_t timestampinc);
169 uint16_t hdrextID,
const void *hdrextdata,
size_t numhdrextwords);
178 uint8_t pt,
bool mark,uint32_t timestampinc,
179 uint16_t hdrextID,
const void *hdrextdata,
size_t numhdrextwords);
180 #ifdef RTP_SUPPORT_SENDAPP
188 int SendRTCPAPPPacket(uint8_t subtype,
const uint8_t name[4],
const void *appdata,
size_t appdatalen);
189 #endif // RTP_SUPPORT_SENDAPP
191 #ifdef RTP_SUPPORT_RTCPUNKNOWN
197 int SendUnknownPacket(
bool sr, uint8_t payload_type, uint8_t subtype,
const void *data,
size_t len);
198 #endif // RTP_SUPPORT_RTCPUNKNOWN
445 void DumpTransmitter();
474 const uint8_t *cname,
size_t cnamelength) { }
510 #ifdef RTP_SUPPORT_THREAD
532 #endif // RTP_SUPPORT_THREAD
535 int CreateCNAME(uint8_t *buffer,
size_t *bufferlength,
bool resolve);
536 int ProcessPolledData();
545 bool deletetransmitter;
546 bool usingpollthread;
547 bool acceptownpackets;
548 bool useSR_BYEifpossible;
550 double sessionbandwidth;
551 double controlfragment;
552 double sendermultiplier;
553 double byemultiplier;
554 double membermultiplier;
555 double collisionmultiplier;
556 double notemultiplier;
559 RTPSessionSources sources;
565 std::list<RTCPCompoundPacket *> byepackets;
567 #ifdef RTP_SUPPORT_THREAD
568 RTPPollThread *pollthread;
569 jthread::JMutex sourcesmutex,buildermutex,schedmutex,packsentmutex;
571 friend class RTPPollThread;
572 #endif // RTP_SUPPORT_THREAD
573 friend class RTPSessionSources;
574 friend class RTCPSessionPacketBuilder;
579 #endif // RTPSESSION_H
int AbortWait()
If the previous function has been called, this one aborts the waiting (only works when you're not usi...
int JoinMulticastGroup(const RTPAddress &addr)
Joins the multicast group specified by addr.
High level class for using RTP.
Definition: rtpsession.h:79
bool GotoNextSourceWithData()
Sets the current source to be the next source in the table which has RTPPacket instances that we have...
Describes an RTCP APP packet.
Definition: rtcpapppacket.h:54
virtual void OnBYEPacket(RTPSourceData *srcdat)
Is called when a BYE packet has been processed for source srcdat.
Definition: rtpsession.h:506
This class is used by the transmission component to store the incoming RTP and RTCP data in...
Definition: rtprawpacket.h:51
Specifies the internal UDP over IPv4 transmitter.
Definition: rtptransmitter.h:71
bool GotoPreviousSourceWithData()
Sets the current source to be the previous source in the table which has RTPPacket instances that we ...
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable=0)
Waits at most a time delay until incoming data has been detected.
virtual void OnAPPPacket(RTCPAPPPacket *apppacket, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an RTCP APP packet apppacket has been received at time receivetime from address sender...
Definition: rtpsession.h:491
Base class for transmission parameters.
Definition: rtptransmitter.h:227
bool GotoFirstSourceWithData()
Sets the current source to be the first source in the table which has RTPPacket instances that we hav...
This class can be used to build RTP packets and is a bit more high-level than the RTPPacket class: it...
Definition: rtppacketbuilder.h:57
int DeleteFromAcceptList(const RTPAddress &addr)
Deletes addr from the list of addresses to accept.
int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen)
If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet c...
void ClearAcceptList()
Clears the list of addresses to accept.
int SetReceiveMode(RTPTransmitter::ReceiveMode m)
Sets the receive mode to m.
bool IsActive()
Returns whether the session has been created or not.
virtual void OnNoteTimeout(RTPSourceData *srcdat)
Is called when the SDES NOTE item for source srcdat has been timed out.
Definition: rtpsession.h:503
This class determines when RTCP compound packets should be sent.
Definition: rtcpscheduler.h:101
void SetNameInterval(int count)
Sets the RTCP interval for the SDES name item.
void ClearDestinations()
Clears the list of destinations.
Interface for generating random numbers.
Definition: rtprandom.h:51
Represents an RTCP compound packet.
Definition: rtcpcompoundpacket.h:53
int SetLocalNote(const void *s, size_t len)
Sets the SDES note item for the local participant to the value s with length len. ...
int BeginDataAccess()
The following member functions (till EndDataAccess}) need to be accessed between a call to BeginDataA...
RTPTransmissionInfo * GetTransmissionInfo()
This function returns an instance of a subclass of RTPTransmissionInfo which will give some additiona...
int SetSessionBandwidth(double bw)
Sets the session bandwidth to bw, which is specified in bytes per second.
RTPTime GetRTCPDelay()
Returns the time interval after which an RTCP compound packet may have to be sent (only works when yo...
void SetLocationInterval(int count)
Sets the RTCP interval for the SDES location item.
void DeletePacket(RTPPacket *p)
Frees the memory used by p.
void SetToolInterval(int count)
Sets the RTCP interval for the SDES tool item.
int AddToAcceptList(const RTPAddress &addr)
Adds addr to the list of addresses to accept.
virtual void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an incoming RTCP packet is about to be processed.
Definition: rtpsession.h:462
int AddToIgnoreList(const RTPAddress &addr)
Adds addr to the list of addresses to ignore.
uint32_t GetLocalSSRC()
Returns our own SSRC.
virtual void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an incoming RTP packet is about to be processed.
Definition: rtpsession.h:458
int Create(const RTPSessionParams &sessparams, const RTPTransmissionParams *transparams=0, RTPTransmitter::TransmissionProtocol proto=RTPTransmitter::IPv4UDPProto)
Creates an RTP session.
int IncrementTimestampDefault()
This function increments the timestamp with the amount given set by the SetDefaultTimestampIncrement ...
This class is an abstract class which is used to specify destinations, multicast groups etc...
Definition: rtpaddress.h:50
int SetDefaultPayloadType(uint8_t pt)
Sets the default payload type for RTP packets to pt.
int DeleteFromIgnoreList(const RTPAddress &addr)
Deletes addr from the list of addresses to ignore.
virtual RTPTransmitter * NewUserDefinedTransmitter()
Allocate a user defined transmitter.
Definition: rtpsession.h:455
RTPSourceData * GetCurrentSourceInfo()
Returns the RTPSourceData instance for the currently selected participant.
virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)
Is called when an SSRC collision was detected.
Definition: rtpsession.h:470
virtual void OnPollThreadError(int errcode)
Is called when error errcode was detected in the poll thread.
Definition: rtpsession.h:512
void BYEDestroy(const RTPTime &maxwaittime, const void *reason, size_t reasonlength)
Sends a BYE packet and leaves the session.
int SetPreTransmissionDelay(const RTPTime &delay)
This function allows you to inform the library about the delay between sampling the first sample of a...
int IncrementTimestamp(uint32_t inc)
This function increments the timestamp with the amount given by inc.
bool GotoNextSource()
Sets the current source to be the next source in the table.
int LeaveMulticastGroup(const RTPAddress &addr)
Leaves the multicast group specified by addr.
virtual void OnBYETimeout(RTPSourceData *srcdat)
Is called when participant srcdat is timed after having sent a BYE packet.
Definition: rtpsession.h:486
Describes an entry in the RTPSources source table.
Definition: rtpsourcedata.h:167
void SetPhoneInterval(int count)
Sets the RTCP interval for the SDES phone item.
void SetEMailInterval(int count)
Sets the RTCP interval for the SDES e-mail item.
int EndDataAccess()
See BeginDataAccess.
int Poll()
If you're not using the poll thread, this function must be called regularly to process incoming data ...
RTPPacket * GetNextPacket()
Extracts the next packet from the received packets queue of the current participant, or NULL if no more packets are available.
void SetNoteInterval(int count)
Sets the RTCP interval for the SDES note item.
virtual void OnUnknownPacketFormat(RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an unknown packet format for a known packet type was detected.
Definition: rtpsession.h:499
RTPSession(RTPRandom *rnd=0, RTPMemoryManager *mgr=0)
Constructs an RTPSession instance, optionally using a specific instance of a random number generator...
int SetLocalEMail(const void *s, size_t len)
Sets the SDES e-mail item for the local participant to the value s with length len.
Abstract class from which actual transmission components should be derived.
Definition: rtptransmitter.h:61
ReceiveMode
Three kind of receive modes can be specified.
Definition: rtptransmitter.h:78
int SetDefaultTimestampIncrement(uint32_t timestampinc)
Sets the default value to increment the timestamp with to timestampinc.
virtual void OnRemoveSource(RTPSourceData *srcdat)
Is called when the entry srcdat is about to be deleted from the source table.
Definition: rtpsession.h:480
int DeleteDestination(const RTPAddress &addr)
Deletes addr from the list of destinations.
virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength)
Is called when another CNAME was received than the one already present for source srcdat...
Definition: rtpsession.h:473
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:80
bool SupportsMulticasting()
Returns true if multicasting is supported.
virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack)
Is called when an RTCP compound packet has just been sent (useful to inspect outgoing RTCP data)...
Definition: rtpsession.h:509
A memory manager.
Definition: rtpmemorymanager.h:147
void Destroy()
Leaves the session without sending a BYE packet.
virtual void OnPollThreadStep()
Is called each time the poll thread loops.
Definition: rtpsession.h:518
This class can be used to build RTCP compound packets, on a higher level than the RTCPCompoundPacketB...
Definition: rtcppacketbuilder.h:63
virtual void OnUnknownPacketType(RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an unknown RTCP packet type was detected.
Definition: rtpsession.h:495
int SetLocalName(const void *s, size_t len)
Sets the SDES name item for the local participant to the value s with length len. ...
int SetLocalTool(const void *s, size_t len)
Sets the SDES tool item for the local participant to the value s with length len. ...
int SetDefaultMark(bool m)
Sets the default marker for RTP packets to m.
void DeleteTransmissionInfo(RTPTransmissionInfo *inf)
Frees the memory used by the transmission information inf.
int AddDestination(const RTPAddress &addr)
Adds addr to the list of destinations.
Represents an RTP Packet.
Definition: rtppacket.h:56
virtual void OnNewSource(RTPSourceData *srcdat)
Is called when a new entry srcdat is added to the source table.
Definition: rtpsession.h:477
int SendPacket(const void *data, size_t len)
Sends the RTP packet with payload data which has length len.
int SetMaximumPacketSize(size_t s)
Sets the maximum allowed packet size to s.
void LeaveAllMulticastGroups()
Leaves all multicast groups.
Base class for specific types of RTCP packets.
Definition: rtcppacket.h:50
Base class for additional information about the transmitter.
Definition: rtptransmitter.h:246
int SendUnknownPacket(bool sr, uint8_t payload_type, uint8_t subtype, const void *data, size_t len)
Tries to send an Unknown packet immediately.
int SetLocalLocation(const void *s, size_t len)
Sets the SDES location item for the local participant to the value s with length len.
virtual void OnPollThreadStart(bool &stop)
Is called when the poll thread is started.
Definition: rtpsession.h:525
void ClearIgnoreList()
Clears the list of addresses to ignore.
This class represents a list of addresses from which SSRC collisions were detected.
Definition: rtpcollisionlist.h:53
bool GotoPreviousSource()
Sets the current source to be the previous source in the table.
bool GotoFirstSource()
Starts the iteration over the participants by going to the first member in the table.
Describes the parameters for to be used by an RTPSession instance.
Definition: rtpsessionparams.h:54
RTPSourceData * GetSourceInfo(uint32_t ssrc)
Returns the RTPSourceData instance for the participant identified by ssrc, or NULL if no such entry e...
int SetTimestampUnit(double u)
Sets the timestamp unit for our own data.
TransmissionProtocol
Used to identify a specific transmitter.
Definition: rtptransmitter.h:69
virtual void OnTimeout(RTPSourceData *srcdat)
Is called when participant srcdat is timed out.
Definition: rtpsession.h:483
int SendPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords)
Sends the RTP packet with payload data which has length len.
int SetLocalPhone(const void *s, size_t len)
Sets the SDES phone item for the local participant to the value s with length len.
virtual void OnPollThreadStop()
Is called when the poll thread is going to stop.
Definition: rtpsession.h:530