ccRTP 2.1.2: queuebase.h Source File

ccRTP 2.1.2
queuebase.h
Go to the documentation of this file.
1 // Copyright (C) 2001-2015 Federico Montesino Pouzols <fedemp@altern.org>.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction. Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License. This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP. If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way. To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36 
43 #ifndef CCXX_RTP_QUEUEBASE_H_
44 #define CCXX_RTP_QUEUEBASE_H_
45 
46 #include <commoncpp/pointer.h>
47 #include <ccrtp/rtppkt.h>
48 #include <ccrtp/sources.h>
49 
50 NAMESPACE_COMMONCPP
51 
68  class __EXPORT AppDataUnit
69 {
70 public:
71  AppDataUnit(const IncomingRTPPkt& packet, const SyncSource& src);
72 
73   inline ~AppDataUnit()
74  { }
75 
79  AppDataUnit(const AppDataUnit& src);
80 
87  AppDataUnit&
88  operator=(const AppDataUnit& source);
89 
93  inline PayloadType
94   getType() const
95 { return datablock->getPayloadType(); }
96 
104  inline const uint8* const
105   getData() const
106 { return datablock->getPayload(); }
107 
111  size_t
112   getSize() const
113 { return datablock->getPayloadSize(); }
114 
118  inline const SyncSource&
119   getSource() const
120 { return *source; }
121 
127  inline bool
128   isMarked() const
129 { return datablock->isMarked(); }
130 
134  inline uint16
135   getSeqNum() const
136 { return datablock->getSeqNum(); }
137 
141  inline uint8
142   getContributorsCount() const
143 { return (uint8)datablock->getCSRCsCount(); }
144 
150  inline const uint32*
151   getContributorsID() const
152 { return datablock->getCSRCs(); }
153 
154 private:
155   Pointer<const IncomingRTPPkt> datablock;
156   const SyncSource* source;
157 };
158 
166  class __EXPORT RTPQueueBase
167 {
168 public:
176  inline bool
177   setPayloadFormat(const PayloadFormat& pf)
178  {
179  currentPayloadType = pf.getPayloadType();
180  currentRTPClockRate = pf.getRTPClockRate();
181  return true;
182  }
183 
184   inline uint32 getLocalSSRC() const
185 { return localSSRC; }
186 
195   inline uint32 getCurrentRTPClockRate() const
196 { return currentRTPClockRate; }
197 
198   inline PayloadType getCurrentPayloadType() const
199 { return currentPayloadType; }
200 
201   inline timeval getInitialTime() const
202 { return initialTime; }
203 
204 protected:
209  RTPQueueBase(uint32 *ssrc = NULL);
210 
211   inline void setLocalSSRC(uint32 ssrc)
212  { localSSRC = ssrc; localSSRCNetwork = htonl(ssrc); }
213 
214   inline uint32 getLocalSSRCNetwork() const
215 { return localSSRCNetwork; }
216 
217  virtual
218   ~RTPQueueBase()
219  { }
220 
227  inline virtual size_t
228   dispatchBYE(const std::string&)
229  { return 0; }
230 
231  inline virtual void
232   renewLocalSSRC()
233  { }
234 
235 private:
236  // local SSRC 32-bit identifier
237   uint32 localSSRC;
238  // SSRC in network byte order
239   uint32 localSSRCNetwork;
240  // RTP clock rate for the current payload type.
241   uint32 currentRTPClockRate;
242  // Current payload type set for outgoing packets and expected
243  // from incoming packets.
244   PayloadType currentPayloadType;
245  // when the queue is created
246   timeval initialTime;
247 };
248 
254  class __EXPORT OutgoingDataQueueBase:
255  public virtual RTPQueueBase
256 {
257 public:
258  inline size_t
259   getDefaultMaxSendSegmentSize()
260  { return defaultMaxSendSegmentSize;}
261 
268  inline void
269   setMaxSendSegmentSize(size_t size)
270  { maxSendSegmentSize = size; }
271 
272  inline size_t
273   getMaxSendSegmentSize()
274  { return maxSendSegmentSize; }
275 
276 protected:
277  OutgoingDataQueueBase();
278 
279  inline virtual
280   ~OutgoingDataQueueBase()
281  { }
282 
283 private:
284   static const size_t defaultMaxSendSegmentSize;
285  // maximum packet size before fragmenting sends.
286   size_t maxSendSegmentSize;
287 };
288 
294  class __EXPORT IncomingDataQueueBase:
295  public virtual RTPQueueBase
296 {
297 public:
298   inline size_t getDefaultMaxRecvPacketSize() const
299 { return defaultMaxRecvPacketSize; }
300 
301  inline size_t
302   getMaxRecvPacketSize() const
303 { return maxRecvPacketSize; }
304 
315  inline void
316   setMaxRecvPacketSize(size_t maxsize)
317  { maxRecvPacketSize = maxsize; }
318 
319 protected:
320   IncomingDataQueueBase()
321  { setMaxRecvPacketSize(getDefaultMaxRecvPacketSize()); }
322 
323  inline virtual
324   ~IncomingDataQueueBase()
325  { }
326 
327 private:
328   static const size_t defaultMaxRecvPacketSize;
329  // filter value for received packets length.
330   size_t maxRecvPacketSize;
331 };
332  // queuebase
334 
335 END_NAMESPACE
336 
337 #endif //CCXX_RTP_QUEUEBASE_H_
338 
OutgoingDataQueueBase::~OutgoingDataQueueBase
virtual ~OutgoingDataQueueBase()
Definition: queuebase.h:280
RTPQueueBase::localSSRC
uint32 localSSRC
Definition: queuebase.h:237
AppDataUnit::isMarked
bool isMarked() const
Is this data unit marked?.
Definition: queuebase.h:128
RTPQueueBase::dispatchBYE
virtual size_t dispatchBYE(const std::string &)
A plugin point for posting of BYE messages.
Definition: queuebase.h:228
AppDataUnit::getType
PayloadType getType() const
Definition: queuebase.h:94
SyncSource
Synchronization source in an RTP session.
Definition: sources.h:192
AppDataUnit
Interface (envelope) to data received over RTP packets.
Definition: queuebase.h:68
AppDataUnit::getSeqNum
uint16 getSeqNum() const
Get data unit sequence number.
Definition: queuebase.h:135
IncomingRTPPkt
RTP packets received from other participants.
Definition: rtppkt.h:704
PayloadFormat
Base payload format class.
Definition: formats.h:129
RTPQueueBase::setPayloadFormat
bool setPayloadFormat(const PayloadFormat &pf)
Set the payload format in use, for timing and payload type identification purposes.
Definition: queuebase.h:177
OutgoingDataQueueBase::getDefaultMaxSendSegmentSize
size_t getDefaultMaxSendSegmentSize()
Definition: queuebase.h:259
IncomingDataQueueBase::maxRecvPacketSize
size_t maxRecvPacketSize
Definition: queuebase.h:330
IncomingDataQueueBase::~IncomingDataQueueBase
virtual ~IncomingDataQueueBase()
Definition: queuebase.h:324
RTPQueueBase::renewLocalSSRC
virtual void renewLocalSSRC()
Definition: queuebase.h:232
sources.h
Sources of synchronization and participants related clases.
IncomingDataQueueBase::getMaxRecvPacketSize
size_t getMaxRecvPacketSize() const
Definition: queuebase.h:302
RTPQueueBase::getCurrentPayloadType
PayloadType getCurrentPayloadType() const
Definition: queuebase.h:198
RTPQueueBase::localSSRCNetwork
uint32 localSSRCNetwork
Definition: queuebase.h:239
RTPQueueBase::getInitialTime
timeval getInitialTime() const
Definition: queuebase.h:201
IncomingDataQueueBase::defaultMaxRecvPacketSize
static const size_t defaultMaxRecvPacketSize
Definition: queuebase.h:328
AppDataUnit::datablock
Pointer< const IncomingRTPPkt > datablock
Definition: queuebase.h:155
PayloadFormat::getPayloadType
PayloadType getPayloadType() const
Get payload type numeric identifier carried in RTP packets.
Definition: formats.h:137
RTPQueueBase::setLocalSSRC
void setLocalSSRC(uint32 ssrc)
Definition: queuebase.h:211
__EXPORT
#define __EXPORT
Definition: ZrtpCallback.h:40
OutgoingDataQueueBase::setMaxSendSegmentSize
void setMaxSendSegmentSize(size_t size)
Set maximum payload segment size before fragmenting sends.
Definition: queuebase.h:269
RTPQueueBase
A virtual base class for RTP queue hierarchies.
Definition: queuebase.h:166
OutgoingDataQueueBase::getMaxSendSegmentSize
size_t getMaxSendSegmentSize()
Definition: queuebase.h:273
RTPQueueBase::getLocalSSRCNetwork
uint32 getLocalSSRCNetwork() const
Definition: queuebase.h:214
AppDataUnit::source
const SyncSource * source
Definition: queuebase.h:156
PayloadFormat::getRTPClockRate
uint32 getRTPClockRate() const
Get RTP clock rate for this payload format.
Definition: formats.h:148
RTPQueueBase::~RTPQueueBase
virtual ~RTPQueueBase()
Definition: queuebase.h:218
RTPQueueBase::currentPayloadType
PayloadType currentPayloadType
Definition: queuebase.h:244
RTPQueueBase::getLocalSSRC
uint32 getLocalSSRC() const
Definition: queuebase.h:184
OutgoingDataQueueBase::maxSendSegmentSize
size_t maxSendSegmentSize
Definition: queuebase.h:286
IncomingDataQueueBase::getDefaultMaxRecvPacketSize
size_t getDefaultMaxRecvPacketSize() const
Definition: queuebase.h:298
RTPQueueBase::initialTime
timeval initialTime
Definition: queuebase.h:246
AppDataUnit::getSource
const SyncSource & getSource() const
Definition: queuebase.h:119
AppDataUnit::getSize
size_t getSize() const
Definition: queuebase.h:112
IncomingDataQueueBase::setMaxRecvPacketSize
void setMaxRecvPacketSize(size_t maxsize)
Definition: queuebase.h:316
AppDataUnit::getContributorsCount
uint8 getContributorsCount() const
Get the number of contributing sources in the CSRC list.
Definition: queuebase.h:142
AppDataUnit::getContributorsID
const uint32 * getContributorsID() const
Get the array of 32-bit CSRC identifiers.
Definition: queuebase.h:151
AppDataUnit::~AppDataUnit
~AppDataUnit()
Definition: queuebase.h:73
AppDataUnit::getData
const uint8 *const getData() const
Get data as it is received in RTP packets (i.e.
Definition: queuebase.h:105
RTPQueueBase::getCurrentRTPClockRate
uint32 getCurrentRTPClockRate() const
Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T).
Definition: queuebase.h:195
OutgoingDataQueueBase::defaultMaxSendSegmentSize
static const size_t defaultMaxSendSegmentSize
Definition: queuebase.h:284
RTPQueueBase::currentRTPClockRate
uint32 currentRTPClockRate
Definition: queuebase.h:241
rtppkt.h
RTP packets handling.
PayloadType
uint8 PayloadType
RTP payload type numeric identifier.
Definition: formats.h:62

Generated on Dec 15, 2017 for ccrtp-2.1.2 (*.h and *.cpp) and libzrtpcpp-2.3.4 (*.h), by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /