Sort bitrates for displaying. Closes #889
This commit is contained in:
parent
6c7945f591
commit
f81c78f9e1
@ -15,15 +15,6 @@ type variantsResponse struct {
|
||||
Index int `json:"index"`
|
||||
}
|
||||
|
||||
// Len returns the number of variants.
|
||||
func (v variants) Len() int { return len(v) }
|
||||
|
||||
// Less is less than..
|
||||
func (v variants) Less(i, j int) bool { return v[i].VideoBitrate < v[j].VideoBitrate }
|
||||
|
||||
// Swap will swap two values.
|
||||
func (v variants) Swap(i, j int) { v[i], v[j] = v[j], v[i] }
|
||||
|
||||
// GetVideoStreamOutputVariants will return the video variants available,
|
||||
func GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
|
||||
outputVariants := data.GetStreamOutputVariants()
|
||||
@ -38,7 +29,7 @@ func GetVideoStreamOutputVariants(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
sort.Slice(result, func(i, j int) bool {
|
||||
return outputVariants[i].VideoBitrate > outputVariants[j].VideoBitrate || !outputVariants[i].IsVideoPassthrough
|
||||
return outputVariants[j].VideoBitrate < outputVariants[i].VideoBitrate
|
||||
})
|
||||
|
||||
WriteResponse(w, result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user