ENDPT_410_ProcessVrgEndptGetRtpStats

lineId = ((VRG_ENDPT_STATE *) endptState)->lineId;
state = GetEndptState( lineId );		//获取ENDPT对象

//查找上层传入的资源ID,是否在驱动中有对应的CNX资源对象,如果没有则返回错误
for( cnxIndex = 0; cnxIndex < VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT; cnxIndex++ )
	if ((state->cnx[cnxIndex]) && (state->cnx[cnxIndex]->cnxId == cnxId))
		break;
if (cnxIndex == VRG_ENDPT_CFG_MAX_CNX_PER_ENDPT)
	return( EPSTATUS_CNX_UNKNOWN );

cnx = state->cnx[cnxIndex];

cnx = state->cnx[cnxIndex];		//获取资源对象

GetConnectionRtpStats(cnx, epRtpStats);
	//非语音模式时,不能访问RTP服务
	if ( cnx->voiceMode != VM_ACTIVE || cnx->vhdMode == NETMODE_FAXRELAY )
		return( EPSTATUS_BAD_MODE );
	
	//向DSP获取RTP状态信息
hdspSendCmdData( cnx->vhdhdl,
                         (HAPI_RTP_GETSTATS_EXT_CMD | HDSP_SYNCCMD_ERR_IGN),
                         HSCMDRESP,
                         sizeof(HAPI_RTP_STATS),
                         &RTPStats);
	
	//向DSP获取语音状态结构
	hdspVhdGetVoiceStats( cnx->vhdhdl, &pveStats )
	
	//向DSP获取平均抖动延时
	hdspVhdGetAvgJBDelay( cnx->vhdhdl, &(epRtpStats->jbAvg)
	
	//根据上面获取的信息填弃应答结构
    epRtpStats->txpkts    = ((RTPStats.cumulative.ingressRtpPacketsHigh)<<16) + 
RTPStats.cumulative.ingressRtpPacketsLow;
    epRtpStats->txbytes   = ((RTPStats.cumulative.ingressRtpBytesHigh)<<16) + 
RTPStats.cumulative.ingressRtpBytesLow;
    epRtpStats->rxpkts    = ((RTPStats.cumulative.egressRtpPacketsHigh)<<16) + 
RTPStats.cumulative.egressRtpPacketsLow;
   epRtpStats->rxbytes   = ((RTPStats.cumulative.egressRtpBytesHigh)<<16) + 
RTPStats.cumulative.egressRtpBytesLow;
    epRtpStats->lost      = 
(((RTPStats.cumulative.egressRtpCumulativeLostPacketsHigh)<<24)>>8)
+ RTPStats.cumulative.egressRtpCumulativeLostPacketsLow;
    epRtpStats->discarded = ((RTPStats.cumulative.egressRtpDiscardedPacketsHigh)<<16) 
+ RTPStats.cumulative.egressRtpDiscardedPacketsLow;
	
    epRtpStats->jitter = ((RTPStats.session.egressRtpJitterHigh)<<16) + 
												RTPStats.session.egressRtpJitterLow;
    epRtpStats->jitter = epRtpStats->jitter >> 3;  // convert jitter from 8kHz samples to msec
	
epRtpStats->latency = ((RTPStats.session.ingressRtpLatencyHigh)<<16) + 
RTPStats.session.ingressRtpLatencyLow;
    epRtpStats->latency = (epRtpStats->latency >> 3) / 2;  // convert latency from 8kHz samples to msec, and divide roundtrip time by 2
	
epRtpStats->peakLatency = ((RTPStats.session.ingressPeakRtpLatencyHigh)<<16) + 
RTPStats.session.ingressPeakRtpLatencyLow;
    epRtpStats->peakLatency = (epRtpStats->peakLatency >> 3) / 2;  // convert latency from 8kHz samples to msec, and divide roundtrip time by 2
	
    epRtpStats->txRtcpPkts = RTPStats.cumulative.ingressRtcpPackets;
    epRtpStats->rxRtcpPkts = RTPStats.cumulative.egressRtcpPackets;
	
    epRtpStats->txRtcpXrPkts = RTPStats.cumulative.ingressRtcpXrPackets;
    epRtpStats->rxRtcpXrPkts = RTPStats.cumulative.egressRtcpXrPackets;
	
    epRtpStats->MOSLQ = RTPStats.session.MOSlq;
    epRtpStats->MOSCQ = RTPStats.session.MOScq;
	
    epRtpStats->jbMin = RTPStats.session.jitterMin >> 3;
    epRtpStats->jbMax = RTPStats.session.jitterMax >> 3;
	
    epRtpStats->overRuns   = pveStats.hsxPVEstats.decoder.overrunCount;
    epRtpStats->underRuns  = pveStats.hsxPVEstats.decoder.ajcUnderrunCount;
    epRtpStats->peakJitter = pveStats.hsxPVEstats.decoder.peakHoldingTime >> 3; // convert peak jitter from 8kHz samples to msec

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值