Skip to content
Snippets Groups Projects
Commit 4bf230c8 authored by Boris Grozev's avatar Boris Grozev
Browse files

Adds the number of packets discarded by the FMJ packet queue to the "call...

Adds the number of packets discarded by the FMJ packet queue to the "call info" window and to the logs at the end of a call.
parent bc31185b
Branches
No related tags found
No related merge requests found
......@@ -2679,6 +2679,16 @@ private void printFlowStatistics(StreamRTPManager rtpManager)
.append("\n").append(StatisticsEngine.RTP_STAT_PREFIX)
.append("unknown types: ").append(rs.getUnknownTypes());
/* The number of discarded packets is not available in
* <tt>GlobalReceptionStats</tt>. Neither is the number of
* decoded using FEC. */
buff.append("\n").append(StatisticsEngine.RTP_STAT_PREFIX)
.append("discarded RTP packets: ")
.append(mediaStreamStatsImpl.getNbDiscarded())
.append("\n").append(StatisticsEngine.RTP_STAT_PREFIX)
.append("decoded with FEC: ")
.append(mediaStreamStatsImpl.getNbFec());
logger.info(buff);
}
catch(Throwable t)
......
......@@ -24,6 +24,7 @@
* Class used to compute stats concerning a MediaStream.
*
* @author Vincent Lucas
* @author Boris Grozev
*/
public class MediaStreamStatsImpl
implements MediaStreamStats
......@@ -70,6 +71,11 @@ private enum StreamDirection
*/
private long[] nbLost = {0, 0};
/**
* The total number of discarded packets
*/
private long nbDiscarded = 0;
/**
* The number of packets for which FEC data was decoded. This is only
*/
......@@ -85,6 +91,11 @@ private enum StreamDirection
*/
private double[] percentLoss = {0, 0};
/**
* The last percent of discarded packets
*/
private double percentDiscarded = 0;
/**
* The last used bandwidth computed in download/upload (in Kbit/s).
*/
......@@ -179,6 +190,9 @@ private void updateStreamDirectionStats(
this.getDownloadNbPDULost() - this.nbLost[streamDirectionIndex];
updateNbLoss(streamDirection, newNbLost, nbSteps + newNbLost);
long newNbDiscarded = this.getNbDiscarded() - this.nbDiscarded;
updateNbDiscarded(newNbDiscarded, nbSteps + newNbDiscarded);
}
// Computes the bandwidth used by this stream.
......@@ -373,6 +387,16 @@ public double getDownloadPercentLoss()
return this.percentLoss[StreamDirection.DOWNLOAD.ordinal()];
}
/**
* Returns the percent of discarded packets
*
* @return the percent of discarded packets
*/
public double getPercentDiscarded()
{
return percentDiscarded;
}
/**
* Returns the percent loss of the upload stream.
*
......@@ -531,7 +555,7 @@ public void updateNewReceivedFeedback(RTCPFeedback feedback)
* @param streamDirection The stream direction (DOWNLOAD or UPLOAD) of the
* stream from which this function updates the stats.
* @param newNbLost The last update of the number of lost.
* @param nbSteps The number of elasped steps since the last number of loss
* @param nbSteps The number of elapsed steps since the last number of loss
* update.
*/
private void updateNbLoss(
......@@ -673,6 +697,25 @@ private long getDownloadNbPDULost()
return nbLost;
}
/**
* Returns the number of Protocol Data Units (PDU) discarded by the
* FMJ packet queue since the beginning of the session. It's the sum over
* all <tt>ReceiveStream</tt>s of the <tt>MediaStream</tt>
*
* @return the number of discarded packets.
*/
public long getNbDiscarded()
{
int nbDiscarded = 0;
java.util.List<ReceiveStream> listReceiveStream =
this.mediaStreamImpl.getDeviceSession().getReceiveStreams();
for(ReceiveStream receiveStream : listReceiveStream)
nbDiscarded += receiveStream.getSourceReceptionStats().getPDUDrop();
return nbDiscarded;
}
/**
* Returns the number of sent/received bytes since the beginning of the
* session.
......@@ -822,4 +865,28 @@ private void updateNbFec()
}
this.nbFec = nbFec;
}
/**
* Updates the number of discarded packets.
*
* @param newNbDiscarded The last update of the number of lost.
* @param nbSteps The number of elapsed steps since the last number of loss
* update.
*/
private void updateNbDiscarded(
long newNbDiscarded,
long nbSteps)
{
double newPercentDiscarded = MediaStreamStatsImpl.computePercentLoss(
nbSteps,
newNbDiscarded);
this.percentDiscarded =
MediaStreamStatsImpl.computeEWMA(
nbSteps,
this.percentDiscarded,
newPercentDiscarded);
// Saves the last update number download lost value.
this.nbDiscarded += newNbDiscarded;
}
}
......@@ -152,4 +152,20 @@ public interface MediaStreamStats
*/
public long getNbFec();
/**
* Returns the total number of discarded packets since the beginning of the
* session.
*
* @return the total number of discarded packets since the beginning of the
* session.
*/
public long getNbDiscarded();
/**
* Returns the current percent of discarded packets.
*
* @return the current percent of discarded packets.
*/
public double getPercentDiscarded();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment