Cleaning up NetEQ statistics
Removed struct MCUStats_t and all references to it. Removed totalDiscardedPackets and totalFlushedPackets from the PacketBuf_t struct. Review URL: http://webrtc-codereview.appspot.com/293001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@999 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
df10de4b27
commit
89ab652250
@ -82,8 +82,6 @@ typedef struct
|
||||
WebRtc_Word16 TSscalingInitialized;
|
||||
enum TsScaling scalingFactor;
|
||||
|
||||
MCUStats_t statInst;
|
||||
|
||||
#ifdef NETEQ_STEREO
|
||||
int usingStereo;
|
||||
#endif
|
||||
|
@ -88,26 +88,6 @@ int WebRtcNetEQ_ResetMcuInCallStats(MCUInst_t *inst)
|
||||
|
||||
int WebRtcNetEQ_ResetMcuJitterStat(MCUInst_t *inst)
|
||||
{
|
||||
inst->statInst.jbAvgCount = 0;
|
||||
inst->statInst.jbAvgSizeQ16 = 0;
|
||||
inst->statInst.jbMaxSize = 0;
|
||||
inst->statInst.jbMinSize = 0xFFFFFFFF;
|
||||
inst->statInst.avgPacketCount = 0;
|
||||
inst->statInst.avgPacketDelayMs = 0;
|
||||
inst->statInst.minPacketDelayMs = 0xFFFFFFFF;
|
||||
inst->statInst.maxPacketDelayMs = 0;
|
||||
inst->statInst.jbChangeCount = 0;
|
||||
inst->statInst.generatedSilentMs = 0;
|
||||
inst->statInst.countExpandMoreThan120ms = 0;
|
||||
inst->statInst.countExpandMoreThan250ms = 0;
|
||||
inst->statInst.countExpandMoreThan500ms = 0;
|
||||
inst->statInst.countExpandMoreThan2000ms = 0;
|
||||
inst->statInst.longestExpandDurationMs = 0;
|
||||
inst->statInst.accelerateMs = 0;
|
||||
|
||||
inst->PacketBuffer_inst.totalDiscardedPackets = 0;
|
||||
inst->PacketBuffer_inst.totalFlushedPackets = 0;
|
||||
|
||||
inst->BufferStat_inst.Automode_inst.countIAT500ms = 0;
|
||||
inst->BufferStat_inst.Automode_inst.countIAT1000ms = 0;
|
||||
inst->BufferStat_inst.Automode_inst.countIAT2000ms = 0;
|
||||
|
@ -36,32 +36,5 @@ typedef struct
|
||||
|
||||
} DSPStats_t;
|
||||
|
||||
/*
|
||||
* Statistics struct on MCU side
|
||||
* All variables are for post-call statistics; queried through WebRtcNetEQ_GetJitterStatistics.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
WebRtc_UWord32 jbMinSize; /* smallest Jitter Buffer size during call in ms */
|
||||
WebRtc_UWord32 jbMaxSize; /* largest Jitter Buffer size during call in ms */
|
||||
WebRtc_UWord32 jbAvgSizeQ16; /* the average JB size, measured over time in ms (Q16) */
|
||||
WebRtc_UWord16 jbAvgCount; /* help counter for jbAveSize */
|
||||
WebRtc_UWord32 minPacketDelayMs; /* min time incoming packet "waited" to be played in ms */
|
||||
WebRtc_UWord32 maxPacketDelayMs; /* max time incoming packet "waited" to be played in ms */
|
||||
WebRtc_UWord16 avgPacketDelayMs; /* avg time incoming packet "waited" to be played in ms */
|
||||
WebRtc_UWord16 avgPacketCount; /* help counter for avgPacketDelayMs */
|
||||
WebRtc_UWord32 jbChangeCount; /* count number of successful accelerate and pre-emptive
|
||||
expand operations */
|
||||
WebRtc_UWord32 generatedSilentMs; /* generated silence in ms */
|
||||
WebRtc_UWord32 countExpandMoreThan120ms; /* count of tiny expansions */
|
||||
WebRtc_UWord32 countExpandMoreThan250ms; /* count of small expansions */
|
||||
WebRtc_UWord32 countExpandMoreThan500ms; /* count of medium expansions */
|
||||
WebRtc_UWord32 countExpandMoreThan2000ms; /* count of large expansions */
|
||||
WebRtc_UWord32 longestExpandDurationMs; /* duration of longest expansions in ms */
|
||||
WebRtc_UWord32 accelerateMs; /* audio data removed through accelerate in ms */
|
||||
|
||||
} MCUStats_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -96,8 +96,6 @@ int WebRtcNetEQ_PacketBufferInit(PacketBuf_t *bufferInst, int maxNoOfPackets,
|
||||
|
||||
/* Reset buffer statistics */
|
||||
bufferInst->discardedPackets = 0;
|
||||
bufferInst->totalDiscardedPackets = 0;
|
||||
bufferInst->totalFlushedPackets = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -116,9 +114,6 @@ int WebRtcNetEQ_PacketBufferFlush(PacketBuf_t *bufferInst)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Increase flush counter */
|
||||
bufferInst->totalFlushedPackets += bufferInst->numPacketsInBuffer;
|
||||
|
||||
/* Set all payload lengths to zero */
|
||||
WebRtcSpl_MemSetW16(bufferInst->payloadLengthBytes, 0, bufferInst->maxInsertPositions);
|
||||
|
||||
@ -437,9 +432,8 @@ int WebRtcNetEQ_PacketBufferFindLowestTimestamp(PacketBuf_t *bufferInst,
|
||||
/* Reduce packet counter by one */
|
||||
bufferInst->numPacketsInBuffer--;
|
||||
|
||||
/* Increase discard counter for in-call and post-call statistics */
|
||||
/* Increase discard counter for in-call statistics */
|
||||
bufferInst->discardedPackets++;
|
||||
bufferInst->totalDiscardedPackets++;
|
||||
}
|
||||
else if (((newDiff < timeStampDiff) || ((newDiff == timeStampDiff)
|
||||
&& (bufferInst->rcuPlCntr[i] < rcuPlCntr))) && (bufferInst->payloadLengthBytes[i]
|
||||
|
@ -50,10 +50,8 @@ typedef struct
|
||||
WebRtc_Word16 *rcuPlCntr; /* zero for non-RCU payload, 1 for main payload
|
||||
2 for redundant payload */
|
||||
|
||||
/* Statistics counters */
|
||||
/* Statistics counter */
|
||||
WebRtc_UWord16 discardedPackets; /* Number of discarded packets */
|
||||
WebRtc_UWord32 totalDiscardedPackets; /* Total number of discarded packets */
|
||||
WebRtc_UWord32 totalFlushedPackets; /* Total number of flushed packets */
|
||||
|
||||
} PacketBuf_t;
|
||||
|
||||
|
@ -33,7 +33,6 @@ int WebRtcNetEQ_RecInInternal(MCUInst_t *MCU_inst, RTPPacket_t *RTPpacketInput,
|
||||
int i_ok = 0, i_No_Of_Payloads = 1;
|
||||
WebRtc_Word16 flushed = 0;
|
||||
WebRtc_Word16 codecPos;
|
||||
WebRtc_UWord32 diffTS, uw32_tmp;
|
||||
int curr_Codec;
|
||||
WebRtc_Word16 isREDPayload = 0;
|
||||
WebRtc_Word32 temp_bufsize = MCU_inst->PacketBuffer_inst.numPacketsInBuffer;
|
||||
@ -249,50 +248,6 @@ int WebRtcNetEQ_RecInInternal(MCUInst_t *MCU_inst, RTPPacket_t *RTPpacketInput,
|
||||
MCU_inst->new_codec = 1;
|
||||
}
|
||||
|
||||
/* update post-call statistics */
|
||||
if (MCU_inst->new_codec != 1) /* not if in codec change */
|
||||
{
|
||||
diffTS = RTPpacket[i_k].timeStamp - MCU_inst->timeStamp; /* waiting time */
|
||||
if (diffTS < 0x0FFFFFFF) /* guard against re-ordering */
|
||||
{
|
||||
/* waiting time in ms */
|
||||
diffTS = WEBRTC_SPL_UDIV(diffTS,
|
||||
WEBRTC_SPL_UDIV((WebRtc_UWord32) MCU_inst->fs, 1000) );
|
||||
if (diffTS < MCU_inst->statInst.minPacketDelayMs)
|
||||
{
|
||||
/* new all-time low */
|
||||
MCU_inst->statInst.minPacketDelayMs = diffTS;
|
||||
}
|
||||
if (diffTS > MCU_inst->statInst.maxPacketDelayMs)
|
||||
{
|
||||
/* new all-time high */
|
||||
MCU_inst->statInst.maxPacketDelayMs = diffTS;
|
||||
}
|
||||
|
||||
/* Update avg waiting time:
|
||||
* avgPacketDelayMs =
|
||||
* (avgPacketCount * avgPacketDelayMs + diffTS)/(avgPacketCount+1)
|
||||
* with proper rounding.
|
||||
*/
|
||||
uw32_tmp
|
||||
= WEBRTC_SPL_UMUL((WebRtc_UWord32) MCU_inst->statInst.avgPacketCount,
|
||||
(WebRtc_UWord32) MCU_inst->statInst.avgPacketDelayMs);
|
||||
uw32_tmp
|
||||
= WEBRTC_SPL_ADD_SAT_W32(uw32_tmp,
|
||||
(diffTS + (MCU_inst->statInst.avgPacketCount>>1)));
|
||||
uw32_tmp = WebRtcSpl_DivU32U16(uw32_tmp,
|
||||
(WebRtc_UWord16) (MCU_inst->statInst.avgPacketCount + 1));
|
||||
MCU_inst->statInst.avgPacketDelayMs
|
||||
= (WebRtc_UWord16) WEBRTC_SPL_MIN(uw32_tmp, (WebRtc_UWord32) 65535);
|
||||
|
||||
/* increase counter, but not to more than 65534 */
|
||||
if (MCU_inst->statInst.avgPacketCount < (0xFFFF - 1))
|
||||
{
|
||||
MCU_inst->statInst.avgPacketCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the payload and insert it into the buffer */
|
||||
i_ok = WebRtcNetEQ_SplitAndInsertPayload(&RTPpacket[i_k],
|
||||
&MCU_inst->PacketBuffer_inst, &MCU_inst->PayloadSplit_inst, &flushed);
|
||||
|
@ -227,48 +227,11 @@ int WebRtcNetEQ_SignalMcu(MCUInst_t *inst)
|
||||
/* Subtract (dspInfo.samplesLeft + inst->timestampsPerCall) from sampleMemory */
|
||||
inst->BufferStat_inst.Automode_inst.sampleMemory -= dspInfo.samplesLeft
|
||||
+ inst->timestampsPerCall;
|
||||
/* Update post-call statistics */
|
||||
inst->statInst.jbChangeCount++;
|
||||
}
|
||||
|
||||
/* calculate total current buffer size (in ms*8), including sync buffer */
|
||||
w32_bufsize = WebRtcSpl_DivW32W16((w32_bufsize + dspInfo.samplesLeft), fs_mult);
|
||||
|
||||
if (((WebRtc_UWord32) w32_bufsize >> 3) < inst->statInst.jbMinSize)
|
||||
{
|
||||
/* new all-time low */
|
||||
inst->statInst.jbMinSize = ((WebRtc_UWord32) w32_bufsize >> 3); /* shift to ms */
|
||||
}
|
||||
if (((WebRtc_UWord32) w32_bufsize >> 3) > inst->statInst.jbMaxSize)
|
||||
{
|
||||
/* new all-time high */
|
||||
inst->statInst.jbMaxSize = ((WebRtc_UWord32) w32_bufsize >> 3); /* shift to ms */
|
||||
}
|
||||
|
||||
/* Update avg bufsize:
|
||||
* jbAvgSize = (jbAvgCount * jbAvgSize + w32_bufsize/8)/(jbAvgCount+1)
|
||||
* with proper rounding
|
||||
*/
|
||||
{
|
||||
WebRtc_Word32 avgTmp;
|
||||
|
||||
/* Simplify the above formula to:
|
||||
* jbAvgSizeQ16 =
|
||||
* jbAvgSizeQ16 + ( (w32_bufsize/8 << 16) - jbAvgSizeQ16 + d ) / (jbAvgCount+1)
|
||||
* where d = jbAvgCount/2 for proper rounding.
|
||||
*/
|
||||
|
||||
avgTmp = (((WebRtc_UWord32) w32_bufsize >> 3) << 16) - inst->statInst.jbAvgSizeQ16;
|
||||
avgTmp = WEBRTC_SPL_DIV( avgTmp + (inst->statInst.jbAvgCount>>1),
|
||||
inst->statInst.jbAvgCount + 1 );
|
||||
inst->statInst.jbAvgSizeQ16 += avgTmp;
|
||||
|
||||
if (inst->statInst.jbAvgCount < (0xFFFF - 1))
|
||||
{
|
||||
inst->statInst.jbAvgCount++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NETEQ_ATEVENT_DECODE
|
||||
/* DTMF data will affect the decision */
|
||||
if (WebRtcNetEQ_DtmfDecode(&inst->DTMF_inst, blockPtr + 1, blockPtr + 2,
|
||||
@ -317,36 +280,6 @@ int WebRtcNetEQ_SignalMcu(MCUInst_t *inst)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update post-call statistics */
|
||||
WebRtc_UWord32
|
||||
expandTime =
|
||||
WEBRTC_SPL_UDIV(WEBRTC_SPL_UMUL_32_16(
|
||||
WEBRTC_SPL_UMUL_32_16((WebRtc_UWord32) inst->NoOfExpandCalls,
|
||||
(WebRtc_UWord16) 1000),
|
||||
inst->timestampsPerCall), inst->fs); /* expand time in ms */
|
||||
|
||||
if (expandTime > 2000)
|
||||
{
|
||||
inst->statInst.countExpandMoreThan2000ms++;
|
||||
}
|
||||
else if (expandTime > 500)
|
||||
{
|
||||
inst->statInst.countExpandMoreThan500ms++;
|
||||
}
|
||||
else if (expandTime > 250)
|
||||
{
|
||||
inst->statInst.countExpandMoreThan250ms++;
|
||||
}
|
||||
else if (expandTime > 120)
|
||||
{
|
||||
inst->statInst.countExpandMoreThan120ms++;
|
||||
}
|
||||
|
||||
if (expandTime > inst->statInst.longestExpandDurationMs)
|
||||
{
|
||||
inst->statInst.longestExpandDurationMs = expandTime;
|
||||
}
|
||||
|
||||
/* reset counter */
|
||||
inst->NoOfExpandCalls = 0;
|
||||
}
|
||||
@ -542,12 +475,6 @@ int WebRtcNetEQ_SignalMcu(MCUInst_t *inst)
|
||||
|
||||
inst->timeStamp = dspInfo.playedOutTS + timeStampJump;
|
||||
|
||||
/* update post-call statistics (since we will reset the CNG counter) */
|
||||
inst->statInst.generatedSilentMs
|
||||
+= WEBRTC_SPL_UDIV(
|
||||
WEBRTC_SPL_UMUL_32_16(inst->BufferStat_inst.uw32_CNGplayedTS, (WebRtc_UWord16) 1000),
|
||||
inst->fs);
|
||||
|
||||
inst->BufferStat_inst.uw32_CNGplayedTS = 0;
|
||||
inst->NoOfExpandCalls = 0;
|
||||
|
||||
@ -685,12 +612,6 @@ int WebRtcNetEQ_SignalMcu(MCUInst_t *inst)
|
||||
inst->BufferStat_inst.w16_cngOn = CNG_OFF;
|
||||
}
|
||||
|
||||
/* update post-call statistics */
|
||||
inst->statInst.generatedSilentMs
|
||||
+= WEBRTC_SPL_UDIV(
|
||||
WEBRTC_SPL_UMUL_32_16(inst->BufferStat_inst.uw32_CNGplayedTS, (WebRtc_UWord16) 1000),
|
||||
inst->fs);
|
||||
|
||||
/*
|
||||
* Reset CNG timestamp as a new packet will be delivered.
|
||||
* (Also if CNG packet, since playedOutTS is updated.)
|
||||
|
@ -1398,12 +1398,6 @@ int WebRtcNetEQ_GetNetworkStatistics(void *inst, WebRtcNetEQ_NetworkStatistics *
|
||||
stats->currentAccelerateRate = 1 << 14; /* 1 in Q14 */
|
||||
}
|
||||
|
||||
/* also transfer measure to post-call statistics */
|
||||
NetEqMainInst->MCUinst.statInst.accelerateMs
|
||||
+= WebRtcSpl_DivU32U16(
|
||||
WEBRTC_SPL_UMUL_32_16( NetEqMainInst->DSPinst.statInst.accelerateLength, (WebRtc_UWord16) 1000),
|
||||
NetEqMainInst->MCUinst.fs);
|
||||
|
||||
/* timestamps elapsed since last report */
|
||||
tempU32 = NetEqMainInst->MCUinst.lastReportTS;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user