From bd2c564601060b29be64e84317880c888d56aa6c Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 24 Feb 2016 15:07:05 -0600 Subject: [PATCH 1/2] Uses the real RTT for send-side bandwidth estimation. --- .../SendSideBandwidthEstimation.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java b/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java index 3ee1c3bef..1e1754738 100644 --- a/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java +++ b/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java @@ -39,7 +39,7 @@ class SendSideBandwidthEstimation /** * send_side_bandwidth_estimation.cc */ - private static final int kBweDecreaseIntervalMs = 300; + private static final long kBweDecreaseIntervalMs = 300; /** * send_side_bandwidth_estimation.cc @@ -366,10 +366,10 @@ public void rembReceived(long bitrateBps) * Returns the last calculated RTT to the endpoint. * @return the last calculated RTT to the endpoint. */ - private synchronized int getRtt() + private synchronized long getRtt() { - //FIXME: the RTT from MediaStreamStats is wrong (always 2^16). - return 100; + long rtt = mediaStream.getMediaStreamStats().getRttMs(); + return (rtt > 0 && rtt < 1000) ? rtt : 1000; } /** From 349f0fbde7be0db4ad78dbcf40ef6bee784af870 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 24 Feb 2016 15:22:00 -0600 Subject: [PATCH 2/2] Logs a message when the calculated RTT is overriden by a default. --- .../SendSideBandwidthEstimation.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java b/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java index 1e1754738..f1423a004 100644 --- a/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java +++ b/src/org/jitsi/impl/neomedia/rtp/sendsidebandwidthestimation/SendSideBandwidthEstimation.java @@ -17,6 +17,7 @@ import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.rtp.*; +import org.jitsi.util.*; import java.util.*; @@ -61,6 +62,13 @@ class SendSideBandwidthEstimation */ private static final int kLimitNumPackets = 20; + /** + * The Logger used by the {@link SendSideBandwidthEstimation} class + * and its instances for logging output. + */ + private static final Logger logger + = Logger.getLogger(SendSideBandwidthEstimation.class); + /** * send_side_bandwidth_estimation.h */ @@ -369,7 +377,14 @@ public void rembReceived(long bitrateBps) private synchronized long getRtt() { long rtt = mediaStream.getMediaStreamStats().getRttMs(); - return (rtt > 0 && rtt < 1000) ? rtt : 1000; + if (rtt < 0 || rtt > 1000) + { + logger.warn("RTT not calculated, or has a suspiciously high value (" + + rtt + "). Using the default of 100ms."); + rtt = 100; + } + + return rtt; } /**