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.
rtcpscheduler.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 RTCPSCHEDULER_H
38 
39 #define RTCPSCHEDULER_H
40 
41 #include "rtpconfig.h"
42 #include "rtptimeutilities.h"
43 #include "rtprandom.h"
44 #include <cstddef>
45 
46 #include "export.h"
47 
48 namespace qrtplib
49 {
50 
51 class RTCPCompoundPacket;
52 class RTPPacket;
53 class RTPSources;
54 
57 {
58 public:
61 
63  int SetRTCPBandwidth(double bw);
64 
66  double GetRTCPBandwidth() const
67  {
68  return bandwidth;
69  }
70 
72  int SetSenderBandwidthFraction(double fraction);
73 
76  {
77  return senderfraction;
78  }
79 
81  int SetMinimumTransmissionInterval(const RTPTime &t);
82 
85  {
86  return mininterval;
87  }
88 
90  void SetUseHalfAtStartup(bool usehalf)
91  {
92  usehalfatstartup = usehalf;
93  }
94 
98  bool GetUseHalfAtStartup() const
99  {
100  return usehalfatstartup;
101  }
102 
105  {
106  immediatebye = v;
107  }
108 
113  {
114  return immediatebye;
115  }
116 private:
117  double bandwidth;
122 };
123 
126 {
127 public:
135  RTCPScheduler(RTPSources &sources, RTPRandom &rtprand);
136  ~RTCPScheduler();
137 
139  void Reset();
140 
142  void SetParameters(const RTCPSchedulerParams &params)
143  {
144  schedparams = params;
145  }
146 
149  {
150  return schedparams;
151  }
152 
154  void SetHeaderOverhead(std::size_t numbytes)
155  {
156  headeroverhead = numbytes;
157  }
158 
160  std::size_t GetHeaderOverhead() const
161  {
162  return headeroverhead;
163  }
164 
166  void AnalyseIncoming(RTCPCompoundPacket &rtcpcomppack);
167 
169  void AnalyseOutgoing(RTCPCompoundPacket &rtcpcomppack);
170 
172  void ActiveMemberDecrease();
173 
177  void ScheduleBYEPacket(std::size_t packetsize);
178 
183  RTPTime GetTransmissionDelay();
184 
190  bool IsTime();
191 
196  RTPTime CalculateDeterministicInterval(bool sender = false);
197 private:
198  void CalculateNextRTCPTime();
199  void PerformReverseReconsideration();
200  RTPTime CalculateBYETransmissionInterval();
201  RTPTime CalculateTransmissionInterval(bool sender);
202 
205  std::size_t headeroverhead;
206  std::size_t avgrtcppacksize;
208  bool firstcall;
211  int pmembers;
212 
213  // for BYE packet scheduling
215  int byemembers, pbyemembers;
216  std::size_t avgbyepacketsize;
218 
220 };
221 
222 } // end namespace
223 
224 #endif // RTCPSCHEDULER_H
225 
void SetHeaderOverhead(std::size_t numbytes)
RTCPSchedulerParams GetParameters() const
std::size_t avgbyepacketsize
void SetUseHalfAtStartup(bool usehalf)
Definition: rtcpscheduler.h:90
double GetRTCPBandwidth() const
Definition: rtcpscheduler.h:66
#define QRTPLIB_API
Definition: export.h:112
std::size_t headeroverhead
RTPTime GetMinimumTransmissionInterval() const
Definition: rtcpscheduler.h:84
RTCPSchedulerParams schedparams
void SetParameters(const RTCPSchedulerParams &params)
std::size_t avgrtcppacksize
std::size_t GetHeaderOverhead() const
double GetSenderBandwidthFraction() const
Definition: rtcpscheduler.h:75