Move GetAudioLevel interface. (#1992)

To allow use with RemoteParticipant/RemoteMediaTrack too.
This commit is contained in:
Raja Subramanian
2023-08-24 13:25:49 +05:30
committed by GitHub
parent 36dadbacb2
commit 8c99a9e307
5 changed files with 160 additions and 19 deletions
-17
View File
@@ -886,23 +886,6 @@ func (p *ParticipantImpl) OnICEConfigChanged(f func(participant types.LocalParti
// signal connection methods
//
func (p *ParticipantImpl) GetAudioLevel() (level float64, active bool) {
level = 0
for _, pt := range p.GetPublishedTracks() {
mediaTrack := pt.(types.LocalMediaTrack)
if mediaTrack.Source() == livekit.TrackSource_MICROPHONE {
tl, ta := mediaTrack.GetAudioLevel()
if ta {
active = true
if tl > level {
level = tl
}
}
}
}
return
}
func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo {
numTracks := 0
minQuality := livekit.ConnectionQuality_EXCELLENT