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) { func (p *ParticipantImpl) GetAudioLevel() (level uint8, active bool) {
level = SilentAudioLevel level = SilentAudioLevel
for _, pt := range p.GetPublishedTracks() { for _, pt := range p.GetPublishedTracks() {
tl, ta := pt.(types.LocalMediaTrack).GetAudioLevel() mediaTrack := pt.(types.LocalMediaTrack)
if ta { if mediaTrack.Source() == livekit.TrackSource_MICROPHONE {
active = true tl, ta := mediaTrack.GetAudioLevel()
if tl < level { if ta {
level = tl active = true
if tl < level {
level = tl
}
} }
} }
} }