CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

CslRtpSession.h
Go to the documentation of this file.
1 ///
2 /// CslRTPSession.h -- Contains a subclass of RTPSession, which is the core of RTP
3 ///
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
10 //
11 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17 // DEALINGS IN THE SOFTWARE.
18 // --------------------------------------------------------------------------
19 ///
20 /// What's here:
21 ///
22 /// CslRtpSession: Adds functionality for handling RTP packets sent by the server.
23 ///
24 /// TODO: Need to unify the client/server main programs into one, so that the user has the option
25 /// of either transmitting data or listening to a port. Also need to extend functionality so that
26 /// the client specifies the server to listen to, rather than the server adding clients manually.
27 /// We also need to write some methods to access the ring buffer, rather than through direct access.
28
29 #ifndef CSL_CSLRTPSESSION_H
30 #define CSL_CSLRTPSESSION_H
31
32 #include "CSL_Core.h"
33 #include "Interleaver.h"
34 #include "RingBuffer.h"
35 #include "CslRtpIncludes.h"
36 #include <iostream>
37
38 namespace csl {
39
40 /// Enumeration to define the possible states of our internal RingBuffer
41 enum RtpBufferState {
42 kNormal = 0,
43 kBuffering,
44 kOverflow,
45 kUnderrun,
46 kInactive,
47
48 kNumStates
49 };
50
51 class CslRtpSession : public RTPSession
52 {
53 public:
54 CslRtpSession(unsigned numChans, unsigned bufferFrames); ///< Constructor
55 ~CslRtpSession(); ///< Destructor
56 RingBuffer mRtpBuffer; ///< The ring buffer between the RTP client and the PortAudio object
57 Buffer mTmpBuffer; ///< A temporary buffer used throughout the class
58 protected:
59 void OnRTPPacket(RTPPacket * pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
60 void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
61
62 void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp);
63 void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,
64 const u_int8_t *cname,size_t cnamelength);
65 void OnNewSource(RTPSourceData *srcdat);
66 void OnRemoveSource(RTPSourceData *srcdat);
67 void OnTimeout(RTPSourceData *srcdat);
68 void OnBYETimeout(RTPSourceData *srcdat);
69 void OnAPPPacket(RTCPAPPPacket *apppacket,const RTPTime &receivetime,
70 const RTPAddress *senderaddress);
71 void OnUnknownPacketType(RTCPPacket *rtcppack,const RTPTime &receivetime,
72 const RTPAddress *senderaddress);
73 void OnUnknownPacketFormat(RTCPPacket *rtcppack,const RTPTime &receivetime,
74 const RTPAddress *senderaddress);
75 void OnNoteTimeout(RTPSourceData *srcdat);
76 void OnBYEPacket(RTPSourceData *srcdat);
77
78 };
79
80 };
81
82 #endif