Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose some internal BWE statistics in GoogleCcEstimator stats. #2041

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,22 @@ public synchronized void setMinBitrate(int minBitrateBps)
remoteRate.setMinBitrate(minBitrateBps);
}

/**
* Get various statistics about the estimation process. [Local addition, not in original C++.]
*/
public synchronized @Nullable Statistics getStatistics()
{
if (detector == null)
{
return null;
}
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 +455,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)
bitrateEstimatorAbsSendTime.statistics?.run {
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
Loading