JRTPLIB  3.11.0
rtpsessionparams.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of JRTPLIB
4  Copyright (c) 1999-2017 Jori Liesenborgs
5 
6  Contact: jori.liesenborgs@gmail.com
7 
8  This library was developed at the Expertise Centre for Digital Media
9  (http://www.edm.uhasselt.be), a research center of the Hasselt University
10  (http://www.uhasselt.be). The library is based upon work done for
11  my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
12 
13  Permission is hereby granted, free of charge, to any person obtaining a
14  copy of this software and associated documentation files (the "Software"),
15  to deal in the Software without restriction, including without limitation
16  the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  and/or sell copies of the Software, and to permit persons to whom the
18  Software is furnished to do so, subject to the following conditions:
19 
20  The above copyright notice and this permission notice shall be included
21  in all copies or substantial portions of the Software.
22 
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29  IN THE SOFTWARE.
30 
31 */
32 
37 #ifndef RTPSESSIONPARAMS_H
38 
39 #define RTPSESSIONPARAMS_H
40 
41 #include "rtpconfig.h"
42 #include "rtptypes.h"
43 #include "rtptransmitter.h"
44 #include "rtptimeutilities.h"
45 #include "rtpsources.h"
46 
47 namespace jrtplib
48 {
49 
54 class JRTPLIB_IMPORTEXPORT RTPSessionParams
55 {
56 public:
58 
62  int SetUsePollThread(bool usethread);
63 
66  int SetNeedThreadSafety(bool s);
67 
69  bool IsUsingPollThread() const { return usepollthread; }
70 
72  void SetMaximumPacketSize(size_t max) { maxpacksize = max; }
73 
75  size_t GetMaximumPacketSize() const { return maxpacksize; }
76 
80  void SetAcceptOwnPackets(bool accept) { acceptown = accept; }
81 
83  bool AcceptOwnPackets() const { return acceptown; }
84 
86  void SetReceiveMode(RTPTransmitter::ReceiveMode recvmode) { receivemode = recvmode; }
87 
89  RTPTransmitter::ReceiveMode GetReceiveMode() const { return receivemode; }
90 
97  void SetOwnTimestampUnit(double tsunit) { owntsunit = tsunit; }
98 
100  double GetOwnTimestampUnit() const { return owntsunit; }
101 
107  void SetResolveLocalHostname(bool v) { resolvehostname = v; }
108 
112  bool GetResolveLocalHostname() const { return resolvehostname; }
113 #ifdef RTP_SUPPORT_PROBATION
114 
115  void SetProbationType(RTPSources::ProbationType probtype) { probationtype = probtype; }
116 
118  RTPSources::ProbationType GetProbationType() const { return probationtype; }
119 #endif // RTP_SUPPORT_PROBATION
120 
122  void SetSessionBandwidth(double sessbw) { sessionbandwidth = sessbw; }
123 
125  double GetSessionBandwidth() const { return sessionbandwidth; }
126 
128  void SetControlTrafficFraction(double frac) { controlfrac = frac; }
129 
131  double GetControlTrafficFraction() const { return controlfrac; }
132 
134  void SetSenderControlBandwidthFraction(double frac) { senderfrac = frac; }
135 
137  double GetSenderControlBandwidthFraction() const { return senderfrac; }
138 
140  void SetMinimumRTCPTransmissionInterval(const RTPTime &t) { mininterval = t; }
141 
143  RTPTime GetMinimumRTCPTransmissionInterval() const { return mininterval; }
144 
148  void SetUseHalfRTCPIntervalAtStartup(bool usehalf) { usehalfatstartup = usehalf; }
149 
153  bool GetUseHalfRTCPIntervalAtStartup() const { return usehalfatstartup; }
154 
156  void SetRequestImmediateBYE(bool v) { immediatebye = v; }
157 
159  bool GetRequestImmediateBYE() const { return immediatebye; }
160 
164  void SetSenderReportForBYE(bool v) { SR_BYE = v; }
165 
169  bool GetSenderReportForBYE() const { return SR_BYE; }
170 
172  void SetSenderTimeoutMultiplier(double m) { sendermultiplier = m; }
173 
175  double GetSenderTimeoutMultiplier() const { return sendermultiplier; }
176 
178  void SetSourceTimeoutMultiplier(double m) { generaltimeoutmultiplier = m; }
179 
181  double GetSourceTimeoutMultiplier() const { return generaltimeoutmultiplier; }
182 
184  void SetBYETimeoutMultiplier(double m) { byetimeoutmultiplier = m; }
185 
187  double GetBYETimeoutMultiplier() const { return byetimeoutmultiplier; }
188 
190  void SetCollisionTimeoutMultiplier(double m) { collisionmultiplier = m; }
191 
193  double GetCollisionTimeoutMultiplier() const { return collisionmultiplier; }
194 
196  void SetNoteTimeoutMultiplier(double m) { notemultiplier = m; }
197 
199  double GetNoteTimeoutMultiplier() const { return notemultiplier; }
200 
202  void SetUsePredefinedSSRC(bool f) { usepredefinedssrc = f; }
203 
205  bool GetUsePredefinedSSRC() const { return usepredefinedssrc; }
206 
208  void SetPredefinedSSRC(uint32_t ssrc) { predefinedssrc = ssrc; }
209 
211  uint32_t GetPredefinedSSRC() const { return predefinedssrc; }
212 
214  void SetCNAME(const std::string &s) { cname = s; }
215 
217  std::string GetCNAME() const { return cname; }
218 
220  bool NeedThreadSafety() const { return m_needThreadSafety; }
221 private:
222  bool acceptown;
223  bool usepollthread;
224  size_t maxpacksize;
225  double owntsunit;
226  RTPTransmitter::ReceiveMode receivemode;
227  bool resolvehostname;
228 #ifdef RTP_SUPPORT_PROBATION
229  RTPSources::ProbationType probationtype;
230 #endif // RTP_SUPPORT_PROBATION
231 
232  double sessionbandwidth;
233  double controlfrac;
234  double senderfrac;
235  RTPTime mininterval;
236  bool usehalfatstartup;
237  bool immediatebye;
238  bool SR_BYE;
239 
240  double sendermultiplier;
241  double generaltimeoutmultiplier;
242  double byetimeoutmultiplier;
243  double collisionmultiplier;
244  double notemultiplier;
245 
246  bool usepredefinedssrc;
247  uint32_t predefinedssrc;
248 
249  std::string cname;
250  bool m_needThreadSafety;
251 };
252 
253 } // end namespace
254 
255 #endif // RTPSESSIONPARAMS_H
256 
void SetCollisionTimeoutMultiplier(double m)
Sets the multiplier to be used when timing out entries in the collision table.
Definition: rtpsessionparams.h:190
bool NeedThreadSafety() const
Returns true if thread safety was requested using RTPSessionParams::SetNeedThreadSafety.
Definition: rtpsessionparams.h:220
void SetOwnTimestampUnit(double tsunit)
Sets the timestamp unit for our own data.
Definition: rtpsessionparams.h:97
double GetSessionBandwidth() const
Returns the session bandwidth in bytes per second (default is 10000 bytes per second).
Definition: rtpsessionparams.h:125
double GetSenderTimeoutMultiplier() const
Returns the multiplier to be used when timing out senders (default is 2).
Definition: rtpsessionparams.h:175
void SetNoteTimeoutMultiplier(double m)
Sets the multiplier to be used when timing out SDES NOTE information.
Definition: rtpsessionparams.h:196
void SetPredefinedSSRC(uint32_t ssrc)
Sets the SSRC which will be used if RTPSessionParams::GetUsePredefinedSSRC returns true...
Definition: rtpsessionparams.h:208
void SetUseHalfRTCPIntervalAtStartup(bool usehalf)
If usehalf is set to true, the session will only wait half of the calculated RTCP interval before sen...
Definition: rtpsessionparams.h:148
bool GetUseHalfRTCPIntervalAtStartup() const
Returns whether the session will only wait half of the calculated RTCP interval before sending its fi...
Definition: rtpsessionparams.h:153
uint32_t GetPredefinedSSRC() const
Returns the SSRC which will be used if RTPSessionParams::GetUsePredefinedSSRC returns true...
Definition: rtpsessionparams.h:211
ProbationType
Type of probation to use for new sources.
Definition: rtpsources.h:78
double GetNoteTimeoutMultiplier() const
Returns the multiplier to be used when timing out SDES NOTE information (default is 25)...
Definition: rtpsessionparams.h:199
bool GetSenderReportForBYE() const
Returns true if a BYE packet will be sent in an RTCP compound packet which starts with a sender repor...
Definition: rtpsessionparams.h:169
void SetCNAME(const std::string &s)
Forces this string to be used as the CNAME identifier.
Definition: rtpsessionparams.h:214
void SetBYETimeoutMultiplier(double m)
Sets the multiplier to be used when timing out a member after it has sent a BYE packet.
Definition: rtpsessionparams.h:184
void SetRequestImmediateBYE(bool v)
If v is true, the session will send a BYE packet immediately if this is allowed.
Definition: rtpsessionparams.h:156
double GetSenderControlBandwidthFraction() const
Returns the minimum fraction of the control traffic that will be used by senders (default is 25%)...
Definition: rtpsessionparams.h:137
bool GetUsePredefinedSSRC() const
Returns a flag indicating if a predefined SSRC should be used.
Definition: rtpsessionparams.h:205
void SetSenderTimeoutMultiplier(double m)
Sets the multiplier to be used when timing out senders.
Definition: rtpsessionparams.h:172
void SetSenderControlBandwidthFraction(double frac)
Sets the minimum fraction of the control traffic that will be used by senders.
Definition: rtpsessionparams.h:134
double GetControlTrafficFraction() const
Returns the fraction of the session bandwidth that will be used for control traffic (default is 5%)...
Definition: rtpsessionparams.h:131
ReceiveMode
Three kind of receive modes can be specified.
Definition: rtptransmitter.h:80
void SetReceiveMode(RTPTransmitter::ReceiveMode recvmode)
Sets the receive mode to be used by the session.
Definition: rtpsessionparams.h:86
void SetAcceptOwnPackets(bool accept)
If the argument is true, the session should accept its own packets and store them accordingly in the ...
Definition: rtpsessionparams.h:80
Definition: rtpfaketransmitter.h:64
std::string GetCNAME() const
Returns the currently set CNAME, is blank when this will be generated automatically (the default)...
Definition: rtpsessionparams.h:217
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:84
void SetSessionBandwidth(double sessbw)
Sets the session bandwidth in bytes per second.
Definition: rtpsessionparams.h:122
bool GetRequestImmediateBYE() const
Returns whether the session should send a BYE packet immediately (if allowed) or not (default is true...
Definition: rtpsessionparams.h:159
bool GetResolveLocalHostname() const
Returns whether the local hostname should be determined from the transmitter's list of local IP addre...
Definition: rtpsessionparams.h:112
size_t GetMaximumPacketSize() const
Returns the maximum allowed packet size (default is 1400 bytes).
Definition: rtpsessionparams.h:75
void SetUsePredefinedSSRC(bool f)
Sets a flag which indicates if a predefined SSRC identifier should be used.
Definition: rtpsessionparams.h:202
RTPTransmitter::ReceiveMode GetReceiveMode() const
Sets the receive mode to be used by the session (default is: accept all packets). ...
Definition: rtpsessionparams.h:89
void SetProbationType(RTPSources::ProbationType probtype)
If probation support is enabled, this function sets the probation type to be used.
Definition: rtpsessionparams.h:115
void SetMaximumPacketSize(size_t max)
Sets the maximum allowed packet size for the session.
Definition: rtpsessionparams.h:72
RTPTime GetMinimumRTCPTransmissionInterval() const
Returns the minimal time interval between sending RTCP packets (default is 5 seconds).
Definition: rtpsessionparams.h:143
double GetOwnTimestampUnit() const
Returns the currently set timestamp unit.
Definition: rtpsessionparams.h:100
double GetSourceTimeoutMultiplier() const
Returns the multiplier to be used when timing out members (default is 5).
Definition: rtpsessionparams.h:181
bool AcceptOwnPackets() const
Returns true if the session should accept its own packets (default is false).
Definition: rtpsessionparams.h:83
void SetControlTrafficFraction(double frac)
Sets the fraction of the session bandwidth to be used for control traffic.
Definition: rtpsessionparams.h:128
void SetResolveLocalHostname(bool v)
Sets a flag indicating if a DNS lookup should be done to determine our hostname (to construct a CNAME...
Definition: rtpsessionparams.h:107
void SetSourceTimeoutMultiplier(double m)
Sets the multiplier to be used when timing out members.
Definition: rtpsessionparams.h:178
void SetMinimumRTCPTransmissionInterval(const RTPTime &t)
Set the minimal time interval between sending RTCP packets.
Definition: rtpsessionparams.h:140
Describes the parameters for to be used by an RTPSession instance.
Definition: rtpsessionparams.h:54
bool IsUsingPollThread() const
Returns whether the session should use a poll thread or not (default is true).
Definition: rtpsessionparams.h:69
void SetSenderReportForBYE(bool v)
When sending a BYE packet, this indicates whether it will be part of an RTCP compound packet that beg...
Definition: rtpsessionparams.h:164
double GetCollisionTimeoutMultiplier() const
Returns the multiplier to be used when timing out entries in the collision table (default is 10)...
Definition: rtpsessionparams.h:193
double GetBYETimeoutMultiplier() const
Returns the multiplier to be used when timing out a member after it has sent a BYE packet (default is...
Definition: rtpsessionparams.h:187
RTPSources::ProbationType GetProbationType() const
Returns the probation type which will be used (default is RTPSources::ProbationStore).
Definition: rtpsessionparams.h:118