limit speaker events to microhpone track (#553)

* limit speaker events to microhpone track

* PR suggestion
This commit is contained in:
sibi
2022-03-22 13:55:06 -07:00
committed by GitHub
parent 13c91678bf
commit adc20649ce
+8 -5
View File
@@ -635,11 +635,14 @@ func (p *ParticipantImpl) ICERestart() error {
func (p *ParticipantImpl) GetAudioLevel() (level uint8, active bool) {
level = SilentAudioLevel
for _, pt := range p.GetPublishedTracks() {
tl, ta := pt.(types.LocalMediaTrack).GetAudioLevel()
if ta {
active = true
if tl < level {
level = tl
mediaTrack := pt.(types.LocalMediaTrack)
if mediaTrack.Source() == livekit.TrackSource_MICROPHONE {
tl, ta := mediaTrack.GetAudioLevel()
if ta {
active = true
if tl < level {
level = tl
}
}
}
}