RtpSender.h

Go to the documentation of this file.
00001 //
00002 //  RemoteIO.h -- CSL I/O Port for sending sample buffers out over UDP or TCP-IP sockets
00003 //      (in response to request packets sent from a RtpReceiver client)
00004 //  See the copyright notice and acknowledgment of authors in the file COPYRIGHT
00005 //
00006 // This is an output driver that receives call-backs from a remote client over a network socket
00007 // and calls on its DSP graph to generate a buffer of samples.
00008 // See the comment in RtpReceiver.h for a description of the packet format
00009 //
00010 // Note to self: The RTP sender is triggered from the nextBuffer call
00011 //
00012 
00013 #ifndef CSL_RTPSENDER_H
00014 #define CSL_RTPSENDER_H
00015 
00016 #include "CSL_Core.h"
00017 //#include "CslRtpIncludes.h"
00018 #include "CslRtpSession.h"
00019 #include "ThreadUtilities.h"
00020 
00021 namespace csl {
00022 
00023 // the RemoteIO class
00024 
00025 // TODO: This should be a variable that can be adjusted or set on the constructor
00026 #define RTP_BUFFER_SIZE (4410)
00027 
00028 // So this really isn't an "effect", but you connect it serially in the existing signal
00029 // chain, thus it conforms to the Effect interface
00030 
00031 class RtpSender : public Effect, public CslRtpSession {
00032 
00033 public:                     // These data members are public so that they can be used from the thread call
00034     RtpSender(unsigned chans = 1);
00035     ~RtpSender();
00036     
00037                     // The work method...
00038     void nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (Exception);
00039 
00040     bool createRtpSession();
00041 
00042     bool addRtpDestination(char * remoteIP, unsigned short remotePort);
00043     bool removeRtpDestination();
00044     void printError(int rtperr);
00045 
00046 protected:
00047     unsigned mNumChans;     // The default # of channels sent over RTP
00048     SynchPthread mRtpMutex;
00049 
00050     unsigned mBufferFrames;
00051     
00052     unsigned mRemotePort;                       
00053     unsigned mLocalPort;                            
00054     unsigned mRemoteIP;                         
00055     unsigned mLocalIP;                      
00056     string mCName;                          
00057     string mEmail;                          
00058     int mLastPacketNumber;                  
00059     int mPayloadType;                       
00060 
00061     RTPUDPv4TransmissionParams  * mTransparams; // We are using UDP over IPv4
00062     RTPSessionParams            * mSessparams;
00063     RTPIPv4Address              * mAddress;
00064 
00065 #ifdef DO_TIMING                    // This is for the performance timing code
00066     struct timeval mThen, mNow;     // Used for getting the real time
00067     long mTimeVals, mThisSec;           // Used for CPU usage statistics
00068     long mTimeSum;
00069 #endif
00070 
00071 
00072 };
00073 
00074 }
00075 
00076 #endif
00077 

Generated on Thu Sep 17 23:14:16 2009 for CSL by  doxygen 1.5.8