Convert sort.Slice -> slices.SortFunc (#4472)

* Convert sort.Slice -> slices.SortFunc

* active speaker loudness in descending order
This commit is contained in:
Raja Subramanian
2026-04-23 15:12:24 +05:30
committed by GitHub
parent 85be9d70fb
commit 701a37c2d1
10 changed files with 83 additions and 53 deletions
+2 -3
View File
@@ -20,7 +20,6 @@ import (
"maps"
"math"
"slices"
"sort"
"strings"
"sync"
"time"
@@ -393,8 +392,8 @@ func (r *Room) GetActiveSpeakers() []*livekit.SpeakerInfo {
})
}
sort.Slice(speakers, func(i, j int) bool {
return speakers[i].Level > speakers[j].Level
slices.SortFunc(speakers, func(a, b *livekit.SpeakerInfo) int {
return sutils.Signum(b.Level - a.Level)
})
// quantize to smooth out small changes