Browse Source

Sort bitrates for displaying. Closes #889

initial-username
Gabe Kangas 5 months ago
parent
commit
f81c78f9e1
1 changed files with 1 additions and 10 deletions
  1. +1
    -10
      controllers/video.go

+ 1
- 10
controllers/video.go View File

@ -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…
Cancel
Save