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
+1 -1
View File
@@ -664,7 +664,7 @@ func (b *BufferBase) SendPLI(force bool) {
pliThrottle := b.pliThrottle
b.RUnlock()
if (rtpStats == nil && !force) || !rtpStats.CheckAndUpdatePli(pliThrottle, force) {
if rtpStats == nil || !rtpStats.CheckAndUpdatePli(pliThrottle, force) {
return
}
+9 -3
View File
@@ -16,7 +16,7 @@ package buffer
import (
"fmt"
"sort"
"slices"
"sync"
"time"
@@ -288,8 +288,14 @@ func ProcessFrameDependencyStructure(structure *dd.FrameDependencyStructure) []D
}
// sort decode target layer by spatial and temporal from high to low
sort.Slice(decodeTargets, func(i, j int) bool {
return decodeTargets[i].Layer.GreaterThan(decodeTargets[j].Layer)
slices.SortFunc(decodeTargets, func(a, b DependencyDescriptorDecodeTarget) int {
if a.Layer.GreaterThan(b.Layer) {
return -1
}
if b.Layer.GreaterThan(a.Layer) {
return 1
}
return 0
})
return decodeTargets