Prevent unnecesarry future head creation

This commit is contained in:
Zoe Roux 2024-01-19 23:49:10 +01:00
parent 6c9a0ea576
commit dd9e0b4fc7

View File

@ -222,7 +222,7 @@ func (ts *Stream) GetSegment(segment int32) (string, error) {
distance := 0.
if !ready {
distance = ts.getMinEncoderDistance(segment)
} else {
} else if !slices.Contains(ts.heads, segment) {
// if the current segment is ready, check next segments are ready and if not start a transcode for them
for i := segment + 1; i <= min(segment+10, int32(len(ts.segments)-1)); i++ {
if slices.Contains(ts.heads, i) {