fix video variant sorting (#1150)
This commit is contained in:
parent
1f05923545
commit
3b6ef78ff7
@ -18,6 +18,11 @@ type variantsResponse struct {
|
|||||||
// GetVideoStreamOutputVariants will return the video variants available.
|
// GetVideoStreamOutputVariants will return the video variants available.
|
||||||
func GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
|
func GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
|
||||||
outputVariants := data.GetStreamOutputVariants()
|
outputVariants := data.GetStreamOutputVariants()
|
||||||
|
|
||||||
|
sort.Slice(outputVariants, func(i, j int) bool {
|
||||||
|
return outputVariants[j].VideoBitrate < outputVariants[i].VideoBitrate
|
||||||
|
})
|
||||||
|
|
||||||
result := make([]variantsResponse, len(outputVariants))
|
result := make([]variantsResponse, len(outputVariants))
|
||||||
|
|
||||||
for i, variant := range outputVariants {
|
for i, variant := range outputVariants {
|
||||||
@ -28,9 +33,5 @@ func GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
|
|||||||
result[i] = variantResponse
|
result[i] = variantResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(result, func(i, j int) bool {
|
|
||||||
return outputVariants[j].VideoBitrate < outputVariants[i].VideoBitrate
|
|
||||||
})
|
|
||||||
|
|
||||||
WriteResponse(w, result)
|
WriteResponse(w, result)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user