Convert sort.Slice -> slices.SortFunc (#4472)
* Convert sort.Slice -> slices.SortFunc * active speaker loudness in descending order
This commit is contained in:
+2
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user