Update latency level values
This commit is contained in:
parent
70389f5abd
commit
6bcbe60c28
@ -394,8 +394,10 @@ func SetS3StorageEnabled(enabled bool) error {
|
||||
// GetStreamLatencyLevel will return the stream latency level.
|
||||
func GetStreamLatencyLevel() models.LatencyLevel {
|
||||
level, err := _datastore.GetNumber(videoLatencyLevel)
|
||||
if err != nil || level == 0 {
|
||||
level = 4
|
||||
if err != nil {
|
||||
level = 2 // default
|
||||
} else if level > 4 {
|
||||
level = 4 // highest
|
||||
}
|
||||
|
||||
return models.GetLatencyLevel(int(level))
|
||||
|
@ -154,21 +154,21 @@ func migrateConfigFile() {
|
||||
_ = SetStreamOutputVariants(variants)
|
||||
|
||||
// Migrate latency level
|
||||
level := 4
|
||||
level := 2
|
||||
oldSegmentLength := oldConfig.VideoSettings.ChunkLengthInSeconds
|
||||
oldNumberOfSegments := oldConfig.Files.MaxNumberInPlaylist
|
||||
latencyLevels := models.GetLatencyConfigs()
|
||||
|
||||
if oldSegmentLength == latencyLevels[1].SecondsPerSegment && oldNumberOfSegments == latencyLevels[1].SegmentCount {
|
||||
if oldSegmentLength == latencyLevels[0].SecondsPerSegment && oldNumberOfSegments == latencyLevels[0].SegmentCount {
|
||||
level = 0
|
||||
} else if oldSegmentLength == latencyLevels[1].SecondsPerSegment && oldNumberOfSegments == latencyLevels[2].SegmentCount {
|
||||
level = 1
|
||||
} else if oldSegmentLength == latencyLevels[2].SecondsPerSegment && oldNumberOfSegments == latencyLevels[2].SegmentCount {
|
||||
level = 2
|
||||
} else if oldSegmentLength == latencyLevels[3].SecondsPerSegment && oldNumberOfSegments == latencyLevels[3].SegmentCount {
|
||||
level = 3
|
||||
} else if oldSegmentLength == latencyLevels[5].SecondsPerSegment && oldNumberOfSegments == latencyLevels[5].SegmentCount {
|
||||
level = 5
|
||||
} else if oldSegmentLength >= latencyLevels[6].SecondsPerSegment && oldNumberOfSegments >= latencyLevels[6].SegmentCount {
|
||||
level = 6
|
||||
} else if oldSegmentLength >= latencyLevels[4].SecondsPerSegment && oldNumberOfSegments >= latencyLevels[4].SegmentCount {
|
||||
level = 4
|
||||
}
|
||||
|
||||
_ = SetStreamLatencyLevel(float64(level))
|
||||
|
@ -10,12 +10,11 @@ type LatencyLevel struct {
|
||||
// GetLatencyConfigs will return the available latency level options.
|
||||
func GetLatencyConfigs() map[int]LatencyLevel {
|
||||
return map[int]LatencyLevel{
|
||||
1: {Level: 1, SecondsPerSegment: 1, SegmentCount: 2},
|
||||
2: {Level: 2, SecondsPerSegment: 2, SegmentCount: 2},
|
||||
3: {Level: 3, SecondsPerSegment: 2, SegmentCount: 3},
|
||||
4: {Level: 4, SecondsPerSegment: 3, SegmentCount: 4}, // Default
|
||||
5: {Level: 5, SecondsPerSegment: 4, SegmentCount: 5},
|
||||
6: {Level: 6, SecondsPerSegment: 6, SegmentCount: 10},
|
||||
0: {Level: 0, SecondsPerSegment: 1, SegmentCount: 3}, // Approx 5 seconds
|
||||
1: {Level: 1, SecondsPerSegment: 2, SegmentCount: 2}, // Approx 7-8 seconds
|
||||
2: {Level: 2, SecondsPerSegment: 3, SegmentCount: 3}, // Default Approx 11 seconds
|
||||
3: {Level: 3, SecondsPerSegment: 4, SegmentCount: 3}, // Approx 15 seconds
|
||||
4: {Level: 4, SecondsPerSegment: 5, SegmentCount: 4}, // Approx 18 seconds
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user