diff --git a/src/main/java/org/jitsi/jicofo/Bridge.java b/src/main/java/org/jitsi/jicofo/Bridge.java index 4a038a0a16..29771a3255 100644 --- a/src/main/java/org/jitsi/jicofo/Bridge.java +++ b/src/main/java/org/jitsi/jicofo/Bridge.java @@ -101,6 +101,11 @@ class Bridge */ private int videoStreamCountDiff = 0; + /** + * The last reported bitrate in Kbps. + */ + private int lastReportedBitrateKbps = 0; + /** * Holds bridge version (if known - not all bridge version are capable of * reporting it). @@ -154,6 +159,13 @@ void setStats(ColibriStatsExtension stats) setVideoStreamCount(videoStreamCount); } + Integer bitrateUpKbps = stats.getValueAsInt(STAT_NAME_BITRATE_UP); + Integer bitrateDownKbps = stats.getValueAsInt(STAT_NAME_BITRATE_DOWN); + if (bitrateUpKbps != null && bitrateDownKbps != null) + { + lastReportedBitrateKbps = bitrateDownKbps + bitrateUpKbps; + } + setIsOperational(!Boolean.valueOf(stats.getValueAsString( JigasiDetector.STAT_NAME_SHUTDOWN_IN_PROGRESS))); } @@ -249,7 +261,8 @@ private void verifyFailureThreshold() } /** - * The least value is returned the least the bridge is loaded. + * The least value is returned the least the bridge is loaded. Currently + * we use the bitrate to estimate load. *
* {@inheritDoc} */ @@ -268,8 +281,7 @@ else if (!meOperational && otherOperational) return 1; } - return this.getEstimatedVideoStreamCount() - - o.getEstimatedVideoStreamCount(); + return this.lastReportedBitrateKbps - o.lastReportedBitrateKbps; } private int getEstimatedVideoStreamCount()