Skip to content

Commit 03d83b3

Browse files
authored
fix: Dropped media detection fires for slow media in the first 2 sec. (#602)
* fix: Dropped media detection fires for slow media in the first 2 sec. * squash: Use suggested by @bgrozev method for skipping the initial period.
1 parent 31ab705 commit 03d83b3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/jitsi/jigasi/SipGatewaySession.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,10 +1399,13 @@ private class ExpireMediaStream
13991399
*/
14001400
private boolean totalStatsSent = false;
14011401

1402+
private static final int CHECK_INTERVAL_MS = 2000;
1403+
private final long start = System.currentTimeMillis();
1404+
14021405
public ExpireMediaStream(AudioMediaStreamImpl stream)
14031406
{
14041407
// we want to check every 2 seconds for the media state
1405-
super(2000, false);
1408+
super(CHECK_INTERVAL_MS, false);
14061409
this.stream = stream;
14071410
}
14081411

@@ -1413,10 +1416,9 @@ public void run()
14131416

14141417
try
14151418
{
1416-
long lastReceived = stream.getLastInputActivityTime();
1419+
long lastReceived = Math.max(stream.getLastInputActivityTime(), start);
14171420

1418-
if (System.currentTimeMillis() - lastReceived
1419-
> mediaDroppedThresholdMs)
1421+
if (System.currentTimeMillis() - lastReceived > mediaDroppedThresholdMs)
14201422
{
14211423
// we want to log only when we go from not-expired into
14221424
// expired state

0 commit comments

Comments
 (0)