/**
  * Get the Variance of all the stats that are watched, for all the stats added with add() since
  * the last call to clear() (in JSON).
  *
  * @return The Variance of all the stats since last clear() in JSON.
  */
 public String getVarianceJSON() {
   String str =
       String.format(
           FakeUserStats.jsonMediaStreamStatsTemplate,
           -1, // ssrc not needed here
           downloadJitterMs.getVariance(),
           downloadPercentLoss.getVariance(),
           downloadRateKiloBitPerSec.getVariance(),
           jitterBufferDelayMs.getVariance(),
           jitterBufferDelayPackets.getVariance(),
           nbDiscarded.getVariance(),
           nbDiscardedFull.getVariance(),
           nbDiscardedLate.getVariance(),
           nbDiscardedReset.getVariance(),
           nbDiscardedShrink.getVariance(),
           nbFec.getVariance(),
           nbPackets.getVariance(),
           nbPacketsLost.getVariance(),
           nbReceivedBytes.getVariance(),
           nbSentBytes.getVariance(),
           packetQueueCountPackets.getVariance(),
           packetQueueSize.getVariance(),
           percentDiscarded.getVariance(),
           rttMs.getVariance(),
           uploadJitterMs.getVariance(),
           uploadPercentLoss.getVariance(),
           uploadRateKiloBitPerSec.getVariance());
   return str;
 }
 /**
  * Add the stats contained by <tt>stats<tt> to their corresponding <tt>SummaryStats</tt>
  * objects.
  *
  * @param stats the stats of a stream that will be added.
  */
 public void add(MediaStreamStats stats) {
   downloadJitterMs.addValue(stats.getDownloadJitterMs());
   downloadPercentLoss.addValue(stats.getDownloadPercentLoss());
   downloadRateKiloBitPerSec.addValue(stats.getDownloadRateKiloBitPerSec());
   jitterBufferDelayMs.addValue(stats.getJitterBufferDelayMs());
   jitterBufferDelayPackets.addValue(stats.getJitterBufferDelayPackets());
   nbDiscarded.addValue(stats.getNbDiscarded());
   nbDiscardedFull.addValue(stats.getNbDiscardedFull());
   nbDiscardedLate.addValue(stats.getNbDiscardedLate());
   nbDiscardedReset.addValue(stats.getNbDiscardedReset());
   nbDiscardedShrink.addValue(stats.getNbDiscardedShrink());
   nbFec.addValue(stats.getNbFec());
   nbPackets.addValue(stats.getNbPackets());
   nbPacketsLost.addValue(stats.getNbPacketsLost());
   nbReceivedBytes.addValue(stats.getNbReceivedBytes());
   nbSentBytes.addValue(stats.getNbSentBytes());
   packetQueueCountPackets.addValue(stats.getPacketQueueCountPackets());
   packetQueueSize.addValue(stats.getPacketQueueSize());
   percentDiscarded.addValue(stats.getPercentDiscarded());
   rttMs.addValue(stats.getRttMs());
   uploadJitterMs.addValue(stats.getUploadJitterMs());
   uploadPercentLoss.addValue(stats.getUploadPercentLoss());
   uploadRateKiloBitPerSec.addValue(stats.getUploadRateKiloBitPerSec());
 }