Skip to content

Commit

Permalink
add lock, fix srt added through update
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Aug 5, 2024
1 parent 1cd3a3a commit c526bd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (c *Controller) UpdateStream(ctx context.Context, req *livekit.UpdateStream

sendUpdate := false
errs := errors.ErrArray{}
now := time.Now().UnixNano()

// add stream outputs first
for _, rawUrl := range req.AddOutputUrls {
Expand Down Expand Up @@ -296,7 +297,9 @@ func (c *Controller) UpdateStream(ctx context.Context, req *livekit.UpdateStream
continue
}

// add to output count
if o.OutputType != types.OutputTypeRTMP {
streamInfo.StartedAt = now
}
c.OutputCount++
sendUpdate = true
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/pipeline/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (c *Controller) gstLog(
if function == fnSendCreateStream {
streamID := strings.Split(message, "'")[1]
if o := c.GetStreamConfig(); o != nil {
c.mu.Lock()
for url, sID := range o.StreamIDs {
if streamID == sID {
if streamInfo := o.StreamInfo[url]; streamInfo != nil && streamInfo.StartedAt == 0 {
Expand All @@ -105,6 +106,7 @@ func (c *Controller) gstLog(
}
}
}
c.mu.Unlock()
}
}
return
Expand Down

0 comments on commit c526bd9

Please sign in to comment.