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