00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CSL_RTPRECEIVER_H
00020 #define CSL_RTPRECEIVER_H
00021
00022 #include "CSL_Core.h"
00023 #include "CslRtpSession.h"
00024 #include "ThreadUtilities.h"
00025
00026
00027
00028 namespace csl {
00029
00030
00031
00032 #define RTP_BUFFER_SIZE (4410)
00033
00034
00035
00036 #define CSL_DEFAULT_CLIENT_PORT 5004 // Default port for RTP listening (RTCP transmitted on port RTP+1)
00037 #define CSL_DEFAULT_SERVER_PORT 5006 // Default port for sending RTP packets (RTCP xmitted on port RTP+1)
00038
00039
00040
00041
00042
00043
00044
00045 extern "C" void * RTP_read_loop(void * inst);
00046
00047
00048
00049 typedef void * (*THREAD_START_ROUTINE)(void *);
00050 extern "C" int CSL_CreateThread(THREAD_START_ROUTINE pfnThreadProc, void * pvParam);
00051
00052
00054
00055
00056
00057
00058 class RtpReceiver : public CslRtpSession, UnitGenerator {
00059
00060 public:
00061
00063 RtpReceiver(unsigned chans = 1);
00064 ~RtpReceiver();
00065
00067 unsigned bufferSize() { return mBufferFrames; };
00068 unsigned remotePort() { return mRemotePort; };
00069
00070 void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (Exception);
00071
00072 void setLocalPort(unsigned localPort);
00073 void setBufferSize(unsigned bufferSize);
00074
00075 bool addRtpSource(char* remoteIP, unsigned short remotePort);
00076 bool removeRtpSource();
00077 void printError(int rtperr);
00078
00079
00080 protected:
00081 bool createRtpSession();
00082
00083 unsigned mNumChans;
00084 SynchPthread mRtpMutex;
00085 unsigned mBufferFrames;
00086
00087 unsigned long mRemoteIP;
00088 unsigned short mRemotePort;
00089 unsigned long mLocalIP;
00090 unsigned short mLocalPort;
00091
00092 RtpBufferState mBufferState;
00093
00094 RTPUDPv4TransmissionParams * mTransparams;
00095 RTPSessionParams * mSessparams;
00096 RTPIPv4Address * mAddress;
00097
00098 unsigned mLastPacketNumber;
00099
00100
00101
00102
00103 };
00104
00105 }
00106
00107 #endif
00108