/******************************************************************************
|
* FILE: RtpApp.h
|
* Description:
|
* Interface class of jrtplib module.
|
*
|
* Modified Code History
|
* Mark Date By Modification Reason
|
*******************************************************************************
|
* 01 2008-4-15 songxw Initial creation.
|
******************************************************************************/
|
|
#if !defined(__RTP_APP_H__)
|
#define __RTP_APP_H__
|
|
#include "TypeDef.h"
|
#include "rtpsession.h"
|
#include "rtpudpv4transmitter.h"
|
#include "rtpsessionparams.h"
|
#include "rtpipv4address.h"
|
#include "str.h"
|
|
using namespace std;
|
using namespace jrtplib;
|
|
#define RTP_PAYLOAD_MAX_LEN 1800 //µ¥¸öRTP¸ºÔØ×î´óÈÝÁ¿
|
#define ONE_FRAME_MAX_LEN 1024 * 1024 * 1 //ÿ֡×î´ó×Ö½ÚÊý
|
#define FILE_MAX_LEN 1024 * 1024 * 100 //Îļþ×î´ó³¤¶È(×Ö½Ú)
|
#define DELETE_OLDEST_HINT_MIN_SIZE 1024 * 20 //ɾ³ýÎļþµÄ×îС´ÅÅ̿ռä, KB
|
#define NOT_SAVING_MIN_SIZE 1024 * 5 //²»´æ´¢µÄ×îС´ÅÅ̿ռä, KB
|
#define GOOD_FILE_MIN_LEN 1024 * 20 //¼ÏñÎļþСÓÚºê(×Ö½Ú)£¬ÊÓΪ»µÎļþ
|
|
#define JRTP_BUFFER_SIZE_NORMAL 2*1024*1024
|
#define JRTP_BUFFER_SIZE_MAX 4*1024*1024
|
|
#define A_RTP_PACKET_DATA_LEN 1400 //1514-42-12
|
|
|
|
/* RTP info from a packet */
|
/*
|
typedef struct
|
{
|
UINT8 DataType; //¸ºÔØÖÖÀà
|
UINT32 DataLen; //¸ºÔس¤¶È
|
bool bIsFrame; //Marker-M
|
UINT16 sNum; //˳ÐòºÅ
|
UINT32 Timestamp; //ʱ¼ä´Á
|
UINT8 *pRawData; //¸ºÔØ
|
}RTPInfo_T;
|
*/
|
|
/* Interface class of jrtplib module */
|
class CRtpApp : public RTPSession
|
{
|
public:
|
CRtpApp();
|
~CRtpApp();
|
|
int CreateSession(UINT16 ListenPort, UINT32 nSsrc = 0, bool usethread = true); //RTP´´½¨
|
void RtpDestroy(); //RTPÏú»Ù
|
|
void SetTsunit(double ts) {tsunit = ts;}
|
double GetTsunit(void) {return tsunit;};
|
|
//Set and send out nat mapping packet
|
int NatMappingControl(char IpStr[], UINT16 port, int SSId);
|
|
RTPUDPv4TransmissionParams TransParams;
|
RTPSessionParams SessParams;
|
|
int GetTimeStamp(void);
|
int GetAudioTimeStamp(void);
|
void ResetTimeStamp(void)
|
{
|
struct timezone tzone;
|
gettimeofday(&RunTime, &tzone);
|
gettimeofday(&RunTime2, &tzone);
|
}
|
|
protected:
|
void OnPollThreadStep();
|
|
//Send a packet to traverse NAT
|
void SendNatMappingPacket(void);
|
|
CRtpApp* GetThis(void) {return this;}
|
|
//NAT packet time interval
|
time_t SendTimeForNAT;
|
|
private:
|
virtual void CBRtpRecv(); //RTP½ÓÊÕ±¨ÎÄ
|
|
double tsunit; //ʱ¼ä´Á
|
|
//Running time
|
struct timeval RunTime;
|
struct timeval RunTime2;
|
|
//Sequence number for a packet of traversing NAT
|
UINT16 SeqNum;
|
|
//Session ID for a call
|
int SessionID;
|
};
|
|
#endif //#if !defined(__RTP_APP_H__)
|