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>
49
50 NAMESPACE_COMMONCPP
51
69 {
70 public:
72
74 { }
75
80
89
95 { return datablock->getPayloadType(); }
96
104 inline const uint8* const
106 { return datablock->getPayload(); }
107
111 size_t
113 { return datablock->getPayloadSize(); }
114
120 { return *source; }
121
127 inline bool
129 { return datablock->isMarked(); }
130
134 inline uint16
136 { return datablock->getSeqNum(); }
137
141 inline uint8
143 { return (uint8)datablock->getCSRCsCount(); }
144
150 inline const uint32*
152 { return datablock->getCSRCs(); }
153
154 private:
157 };
158
167 {
168 public:
176 inline bool
178 {
181 return true;
182 }
183
185 { return localSSRC; }
186
196 { return currentRTPClockRate; }
197
199 { return currentPayloadType; }
200
202 { return initialTime; }
203
204 protected:
210
212 { localSSRC = ssrc; localSSRCNetwork = htonl(ssrc); }
213
215 { return localSSRCNetwork; }
216
217 virtual
219 { }
220
227 inline virtual size_t
229 { return 0; }
230
231 inline virtual void
233 { }
234
235 private:
236 // local SSRC 32-bit identifier
238 // SSRC in network byte order
240 // RTP clock rate for the current payload type.
242 // Current payload type set for outgoing packets and expected
243 // from incoming packets.
245 // when the queue is created
247 };
248
256 {
257 public:
258 inline size_t
260 { return defaultMaxSendSegmentSize;}
261
268 inline void
270 { maxSendSegmentSize = size; }
271
272 inline size_t
274 { return maxSendSegmentSize; }
275
276 protected:
278
279 inline virtual
281 { }
282
283 private:
285 // maximum packet size before fragmenting sends.
287 };
288
296 {
297 public:
299 { return defaultMaxRecvPacketSize; }
300
301 inline size_t
303 { return maxRecvPacketSize; }
304
315 inline void
317 { maxRecvPacketSize = maxsize; }
318
319 protected:
321 { setMaxRecvPacketSize(getDefaultMaxRecvPacketSize()); }
322
323 inline virtual
325 { }
326
327 private:
329 // filter value for received packets length.
331 };
332 // queuebase
334
335 END_NAMESPACE
336
337 #endif //CCXX_RTP_QUEUEBASE_H_
338
virtual ~OutgoingDataQueueBase()
bool isMarked() const
Is this data unit marked?.
virtual size_t dispatchBYE(const std::string &)
A plugin point for posting of BYE messages.
PayloadType getType() const
Synchronization source in an RTP session.
Interface (envelope) to data received over RTP packets.
uint16 getSeqNum() const
Get data unit sequence number.
RTP packets received from other participants.
bool setPayloadFormat(const PayloadFormat &pf)
Set the payload format in use, for timing and payload type identification purposes.
size_t getDefaultMaxSendSegmentSize()
virtual ~IncomingDataQueueBase()
virtual void renewLocalSSRC()
Sources of synchronization and participants related clases.
size_t getMaxRecvPacketSize() const
PayloadType getCurrentPayloadType() const
timeval getInitialTime() const
static const size_t defaultMaxRecvPacketSize
Pointer< const IncomingRTPPkt > datablock
void setLocalSSRC(uint32 ssrc)
void setMaxSendSegmentSize(size_t size)
Set maximum payload segment size before fragmenting sends.
A virtual base class for RTP queue hierarchies.
size_t getMaxSendSegmentSize()
uint32 getLocalSSRCNetwork() const
const SyncSource * source
PayloadType currentPayloadType
uint32 getLocalSSRC() const
size_t maxSendSegmentSize
size_t getDefaultMaxRecvPacketSize() const
const SyncSource & getSource() const
void setMaxRecvPacketSize(size_t maxsize)
uint8 getContributorsCount() const
Get the number of contributing sources in the CSRC list.
const uint32 * getContributorsID() const
Get the array of 32-bit CSRC identifiers.
const uint8 *const getData() const
Get data as it is received in RTP packets (i.e.
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).
static const size_t defaultMaxSendSegmentSize
uint32 currentRTPClockRate
uint8 PayloadType
RTP payload type numeric identifier.