📄 jb.h
字号:
#define RTP_PT_H263 34 /* H.263 (90000 Hz) */
#endif /* __JBH__ */
/********************************************************************30**
End of file: jb.h 1.0 - 01/21/2000
*********************************************************************31*/
/********************************************************************40**
Notes:
*********************************************************************41*/
/********************************************************************50**
*********************************************************************51*/
/********************************************************************60**
Revision history:
*********************************************************************61*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* include all the module specific files */
/* typedefs */
/* forward type declarations */
/***********************************************************************
Gen Config Structure
***********************************************************************/
typedef struct jbGenCfg
{
Bool cfgDone; /* Flag to say if GenCfg is done */
S16 maxConnections; /* Max number of active conn */
S16 maxSize; /* Max size of buffer in packets
(must be a power of 2) */
} JbGenCfg;
/***********************************************************************
Buffer Config Structure
***********************************************************************/
typedef struct jbJitterCfg
{
/* slm: changed maxLatency to 16 bit to be consistent */
U16 maxLatency; /* Maximum level the Jitter Buffer
is allowed to fill in packets */
U16 maxHoldTime; /* Maximum number of playAttempts to wait
before releasing a packet, represented
as a percentage of the HWM */
U8 minSize; /* Minimum size of the Buffer in packets */
U8 minStableTime; /* Minimum time the jitter needs to be less
than the HWM before the HWM is reduced */
U16 incAmount; /* Used to increase the HWM */
U16 decAmount; /* Used to decrease the HWM */
// TmrCfg longSilenceTimer; /* Used to determine the cause of an underflow */
U16 longSilenceTimer;
} JbJitterCfg;
/***********************************************************************
Buffer Structure
***********************************************************************/
typedef struct jBuf
{
U32 seqNum; /* sequence number of packet. */
U32 len; /* slm: length of data in buffer.
This equals 0 if empty */
Ticks timeStamp; /* timestamp of packet */
Data *buffer; /* pointer to data buffer */
} JBuf;
/***********************************************************************
Jitter Structure
***********************************************************************/
typedef struct jitter
{
U8 p; /* play index in buffer */
U8 q; /* put index in buffer */
U8 maxJitter; /* max jitter in currentStableTime */
U8 currentStableTime; /* time jitter has been less than hwm */
U8 playAttempts; /* number playAttempts in ActiveHold state */
U8 receivePacketCount; /* number of received packets in a row */
U8 playPacketCount; /* number of played packet in a row */
U8 gotFirst; /* got first pkt */
U8 bufferDrop; /* slm: MR4213 flag to indicate dropping buffer */
U8 bufferCreep; /* slm: MR4213 counter to watch for buffer creep */
U16 lastSeqNum; /* last seq# received */
U16 maxLatency; /* max latency in packets */
U16 dropWait; /* slm: MR4213 wait count for stable packets before drop */
U16 maxAlSduFrames; /* slm: MR4213 max frames */
Ticks curTimestamp; /* slm: MR4213 current timestamp */
JBuf *jBuf; /* pointer to the jitter buffer */
JbState state; /* jitter state */
} Jitter;
/***********************************************************************
Connection stats
***********************************************************************/
typedef struct jbConnSts
{
S32 packetsTx; /* Transmitted packets to RTP */
S32 packetsRx; /* Received packets from DSP */
S32 packetsLate; /* This gets incremented when there
isn't room to put a packet before
the q pointer */
S32 packetsDropped; /* Total number of packets dropped */
S32 packetsLost; /* This gets incremented when the buffer
tries to play an empty packet */
S32 packetsRedundant; /* This gets incremented when the
buffer attempts to insert a packet
in a non-empty slot in the buffer */
S32 breaks; /* Total number of speech breaks */
S32 numPackets; /* Current level of jitter buffer */
S32 jitterBufferSize; /* Current High Water Mark */
S32 currentJitter;
} JbConnSts;
/***********************************************************************
Connection key
***********************************************************************/
typedef struct jbConnKey
{
S32 sessionId; /* ID of current session */
// SpId spId; /* Service provider ID of session */
CoderInfo txCodec; /* Tx Codec type */
CoderInfo rxCodec; /* Rx Codec type */
S16 lineNo; /* slm: MR8849 add line number */
} JbConnKey;
/***********************************************************************
Jitter Buffer Stats
***********************************************************************/
typedef struct jbCbSts
{
S32 totalConnections; /* Total connections since init */
S32 activeConnections; /* Current number of connections */
} JbCbSts;
/***********************************************************************
Connection control block
***********************************************************************/
typedef struct jbConnCb
{
// CmHashListEnt conn;
U8 connIndex; /* Index into jbCb connection list */
JbConnKey key; /* Hash list key */
JbConnSts sts; /* Connection stats */
Jitter jitter; /* Buffer Structure */
} JbConnCb;
/***********************************************************************
Management Structure
***********************************************************************/
typedef struct jbCfg
{
ConfigType type; /* type of config request */
union
{
JbGenCfg genCfg; /* General Config Structure */
JbJitterCfg jitterCfg; /* Buffer Config Structure */
} c;
} JbCfg;
typedef struct jbSts
{
StatsType type; /* type of stats requested */
Bool clearConnSts; /* Flag to clear conn stats */
union
{
JbCbSts jbCbSts; /* Control Block Stats */
JbConnSts jbConnSts; /* Connection Stats */
} s;
} JbSts;
/***********************************************************************
JitterBuffer Global Control Block
***********************************************************************/
typedef struct jbCb
{
// CmHashListCp connHlCp; /* Hash list containing all active connections */
// TskInit jbInit; /* Init Structure for jb */
vector<JbConnCb> connHlCp;
JbGenCfg genCfg; /* General config structure */
JbJitterCfg jitCfg; /* Buffer config structure */
JbCbSts sts; /* Jitter Buffer System Stats */
// JbConnKey **conn; /* List of Connection Keys */
// CmTqCp jbTqCp; /* Jitter Buffer Timing Queue Control Point */
// CmTqType jbTq[JB_TQSIZE]; /* Jitter Buffer Timing Queue */
// CmTimer *jbTimers; /* Jitter Buffer Timers */
vector<JbConnKey*> conn;
vector<int> jbTimers;
/* slm: MR8849 now use array of activeConn for multiple lines */
U8 activeConn[JB_MAX_LINENUMS]; /* Index of Active call in Conn Key List */
S16 timerRes;
// VMutex sem;
SEM_ID sem;
/* slm: MR8849 now use array of dspSem for multiple lines */
// VMutex dspSem[JB_MAX_LINENUMS]; /* slm: MR4386 need to protect accesses
// to DSP from multiple writes */
SEM_ID dspSem[JB_MAX_LINENUMS];
} JbCb;
#ifdef DEBUG_JB
#define MAX_JBDBG 1024
typedef struct jbDebug_d
{
U32 op;
U32 timestamp;
U32 pkttimestamp;
U32 curtimestamp;
U32 seq;
U32 state;
U32 p;
U32 q;
U32 frames;
U32 length;
S32 numPackets;
S32 jitterBufferSize;
} JbDebug_d;
typedef struct jbDebug_e
{
U32 timestamp;
U32 pkttimestamp;
U32 frames;
U32 length;
} JbDebug_e;
#endif
typedef S16 (*PFJBFSM) ARGS((JbConnCb *connCb, Data *mBuf, HrRtpHdr *rtpHdr));
EXTERN PFJBFSM JbFSM[NMB_JB_EVNT][NMB_JB_ST];
/***************************************************************************
External References
****************************************************************************/
/*--------------------------------------------------------------------
Global variables
---------------------------------------------------------------------*/
EXTERN JbCb jbCb; /* H.323 global control block */
EXTERN Data getBuf[JB_MAX_BUF_SIZE];
EXTERN JbConnCb connCb;
/*--------------------------------------------------------------------
system services interface functions
---------------------------------------------------------------------*/
EXTERN S16 jbActvInit ARGS ((void));
//EXTERN S16 jbActvTsk ARGS((Pst *pst, Buffer *mBuf));
//EXTERN S16 jbActvTmr ARGS ((void));
EXTERN VOID jbDspGetManager ARGS ((/*JbConnKey **connCb, */S8 num, U8 connIndex));
EXTERN VOID jbDspPutManager ARGS ((/*JbConnKey **connCb,*/U8 connIndex));
EXTERN VOID jbReadSocket ARGS ((HRTPSESSION hRTP, void *connId));
/*--------------------------------------------------------------------
public functions used internally by JB module
---------------------------------------------------------------------*/
EXTERN S16 JbStartTimer ARGS((JbConnCb *connCb));
EXTERN S16 JbStopTimer ARGS((JbConnCb *connCb));
EXTERN S16 JbUpdateJitter ARGS((JbConnCb *connCb, JbEvent event));
EXTERN S16 JbInsertPacket ARGS((JbConnCb *connCb,
Data *mBuf,
HrRtpHdr *rtpHdr));
EXTERN S16 JbRemovePacket ARGS((JbConnCb *connCb));
/*--------------------------------------------------------------------
public functions exported by JB module
---------------------------------------------------------------------*/
EXTERN S16 JbCfgReq ARGS((JbCfg *cfg));
EXTERN S16 JbStaReq ARGS((S32 sessionId,
JbSts *sts));
EXTERN S16 JbCntrlReq ARGS((S32 sessionId));
EXTERN S16 JbConReq ARGS((S32 sessionId,
U8 txCodec,
U8 rxCodec,
U16 maxALSduFrames,
U16 payload,
U16 encodeRate));
EXTERN S16 JbDiscReq ARGS((S32 sessionId,
U16 maxALSduFrames));
EXTERN S16 JbDatInd ARGS((S32 sessionId,
HrRtpHdr *rtpHdr,
Data *mBuf));
EXTERN S16 JbUpdateConCb ARGS((S32 sessionId,
U32 h245Msg2));
#ifdef __cplusplus
}
#endif /* __cplusplus */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -