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
+16
View File
@@ -418,3 +418,19 @@ func (u *UpTrackManager) DebugInfo() map[string]interface{} {
return info
}
func (u *UpTrackManager) GetAudioLevel() (level float64, active bool) {
level = 0
for _, pt := range u.GetPublishedTracks() {
if pt.Source() == livekit.TrackSource_MICROPHONE {
tl, ta := pt.GetAudioLevel()
if ta {
active = true
if tl > level {
level = tl
}
}
}
}
return
}