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
ENDPT_410_ProcessVrgEndptGetRtpStats
最新推荐文章于 2013-09-24 00:36:13 发布