Skip to content

Commit

Permalink
Expose some internal BWE statistics in GoogleCcEstimator stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox committed Aug 18, 2023
1 parent 1a86219 commit 4ac5058
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Lyubomir Marinov
*/
enum BandwidthUsage
public enum BandwidthUsage
{
kBwNormal(0), kBwUnderusing(-1), kBwOverusing(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,9 @@ private void updateThreshold(double modifiedOffset, long nowMs)

lastUpdateMs = nowMs;
}

public double getThreshold()
{
return threshold;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ public synchronized void setMinBitrate(int minBitrateBps)
remoteRate.setMinBitrate(minBitrateBps);
}

/**
* Get various statistics about the estimation process. [Local addition, not in original C++.]
*/
public synchronized Statistics getStatistics()
{
return new Statistics(
detector.estimator.getOffset(),
detector.detector.getThreshold(),
detector.detector.getState()
);
}

/**
* Holds the {@link InterArrival}, {@link OveruseEstimator} and
* {@link OveruseDetector} instances that estimate the remote bitrate of a
Expand Down Expand Up @@ -439,4 +451,20 @@ public static long convertMsTo24Bits(long timeMs)
{
return (((timeMs << kAbsSendTimeFraction) + 500) / 1000) & 0x00FFFFFF;
}

/**
* Various statistics about the estimation process. [Local addition, not in original C++.]
*/
public static class Statistics {
public double offset;
public double threshold;
public BandwidthUsage hypothesis;

public Statistics(double o, double t, BandwidthUsage h)
{
offset = o;
threshold = t;
hypothesis = h;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ class GoogleCcEstimator(diagnosticContext: DiagnosticContext, parentLogger: Logg
getCurrentBw(now)
).apply {
addNumber("incomingEstimateExpirations", bitrateEstimatorAbsSendTime.incomingEstimateExpirations)
addNumber("latestDelayEstimate", sendSideBandwidthEstimation.latestREMB)
with(bitrateEstimatorAbsSendTime.statistics) {
addNumber("delayBasedEstimatorOffset", offset)
addNumber("delayBasedEstimatorThreshold", threshold)
addNumber("delayBasedEstimatorHypothesis", hypothesis.value)
}
addNumber("latestDelayBasedEstimate", sendSideBandwidthEstimation.latestREMB)
addNumber("latestLossFraction", sendSideBandwidthEstimation.latestFractionLoss / 256.0)
with(sendSideBandwidthEstimation.statistics) {
update(now.toEpochMilli())
Expand Down

0 comments on commit 4ac5058

Please sign in to comment.