public class BasicActiveSpeakerDetector extends AbstractActiveSpeakerDetector
ActiveSpeakerDetector
which aids the implementations
of actual algorithms for the detection/identification of the active/dominant
speaker in a multipoint conference.
For each stream, it keeps the last History#SIZE
levels and uses them
to compute a score.
At all times one stream (indicated in active
) is considered active,
while the rest are considered 'competing'.
When a new audio level is received for a stream, its score is recomputed, and the scores of all streams are examined in order to determine if one of the competing streams should replace the then active stream.
In order to be eligible to replace the active stream, a competing stream has
to:
1. Have a score at least ACTIVE_COEF
times as much as the score of
the currently active stream.
2. Have score at least MIN_NEW_ACTIVE_SCORE
.
3. Have had its audio level updated in the last
MAX_NEW_ACTIVE_SILENT_INTERVAL
milliseconds.
4. Have updated its audio level at least MIN_NEW_ACTIVE_SIZE
times.
In order to actually replace the active, a competing stream has to have the highest score amongst all eligible streams.
These rules and the constant values were chosen based on a few not very thorough tests in a conference. Some justification for the rules: 1. Helps to avoid often changing the active when there are two streams with similar levels. 2. This is to prevent switching the active stream away during times of "silence". Without this threshold we observed the following: someone's microphone generates noise with levels above the levels of the active speaker. When the active speaker pauses speaking, the one with the higher noise becomes active. 3. This is for the case when someone quits the conference shouting ;) 4. This is because of the way we compute scores. Just-added streams might have an uncharacteristically high score.
Constructor and Description |
---|
BasicActiveSpeakerDetector() |
Modifier and Type | Method and Description |
---|---|
void |
levelChanged(long ssrc,
int level)
Notifies this ActiveSpeakerDetector about the latest/current
audio level of a stream/speaker identified by a specific synchronization
source identifier/SSRC.
|
addActiveSpeakerChangedListener, fireActiveSpeakerChanged, getActiveSpeakerChangedListeners, removeActiveSpeakerChangedListener
public void levelChanged(long ssrc, int level)
ActiveSpeakerDetector
ssrc
- the SSRC of the stream/speakerlevel
- the latest/current audio level of the stream/speaker with
the specified ssrc
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.