mirror of
https://github.com/livekit/livekit.git
synced 2026-07-28 14:19:32 +00:00
limit speaker events to microhpone track (#553)
* limit speaker events to microhpone track * PR suggestion
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user