mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Fix out of range segment checking for future segments
This commit is contained in:
parent
f1c3844bd3
commit
0517f85d76
@ -224,14 +224,14 @@ func (ts *Stream) GetSegment(segment int32) (string, error) {
|
|||||||
distance = ts.getMinEncoderDistance(segment)
|
distance = ts.getMinEncoderDistance(segment)
|
||||||
} else {
|
} else {
|
||||||
// if the current segment is ready, check next segments are ready and if not start a transcode for them
|
// if the current segment is ready, check next segments are ready and if not start a transcode for them
|
||||||
for i := int32(1); i <= 10; i++ {
|
for i := segment + 1; i <= min(segment+10, int32(len(ts.segments))); i++ {
|
||||||
if slices.Contains(ts.heads, segment+i) {
|
if slices.Contains(ts.heads, i) {
|
||||||
// no need to create a new transcoder if there is already one running for this segment
|
// no need to create a new transcoder if there is already one running for this segment
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !ts.isSegmentReady(segment + i) {
|
if !ts.isSegmentReady(i) {
|
||||||
log.Printf("Creating new head for future segment (%d)", segment+i)
|
log.Printf("Creating new head for future segment (%d)", i)
|
||||||
go ts.run(segment + i)
|
go ts.run(i)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user