Skip to content

Commit 256453c

Browse files
authored
add mutex to transcodeFromSegment. (#43)
1 parent e3c4233 commit 256453c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hlsvod/manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const readyTimeout = 80 * time.Second
2525
const transcodeTimeout = 10 * time.Second
2626

2727
type ManagerCtx struct {
28+
mu sync.Mutex
2829
logger zerolog.Logger
2930
config Config
3031

@@ -454,6 +455,9 @@ func (m *ManagerCtx) transcodeSegments(offset, limit int) error {
454455
}
455456

456457
func (m *ManagerCtx) transcodeFromSegment(index int) error {
458+
m.mu.Lock()
459+
defer m.mu.Unlock()
460+
457461
segmentsTotal := len(m.segments)
458462
if segmentsTotal <= m.segmentBufferMax {
459463
// if all our segments can fit in the buffer

0 commit comments

Comments
 (0)