Skip to content

Commit

Permalink
Fix routing of audio and stats when routeLoudestOnly is disabled (#2055)
Browse files Browse the repository at this point in the history
* fix: Don't drop audio when routeLoudestOnly is disabled in config.

* fix: Do not drop stats when routeLoudestOnly is disabled.
  • Loading branch information
bgrozev authored Sep 27, 2023
1 parent c706fa9 commit ea56278
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jvb/src/main/java/org/jitsi/videobridge/Conference.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ public long getLocalVideoSsrc()

@NotNull private final EncodingsManager encodingsManager = new EncodingsManager();

/**
* Cache here because it's accessed on every packet.
*/
private final boolean routeLoudestOnly = LoudestConfig.getRouteLoudestOnly();

/**
* The task of updating the ordered list of endpoints in the conference. It runs periodically in order to adapt to
* endpoints stopping or starting to their video streams (which affects the order).
Expand Down Expand Up @@ -1126,7 +1131,9 @@ public boolean isRankedSpeaker(AbstractEndpoint ep)
{
if (!LoudestConfig.Companion.getRouteLoudestOnly())
{
return false;
// When "route loudest only" is disabled all speakers should be considered "ranked" (we forward all audio
// and stats).
return true;
}
return speechActivity.isAmongLoudest(ep.getId());
}
Expand Down Expand Up @@ -1275,7 +1282,7 @@ else if (pph.wants(packetInfo))
public boolean levelChanged(@NotNull AbstractEndpoint endpoint, long level)
{
SpeakerRanking ranking = speechActivity.levelChanged(endpoint, level);
if (ranking == null)
if (ranking == null || !routeLoudestOnly)
return false;
if (ranking.isDominant && LoudestConfig.Companion.getAlwaysRouteDominant())
return false;
Expand Down

0 comments on commit ea56278

Please sign in to comment.