Skip to content

Commit

Permalink
close src once recording has stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Jul 30, 2024
1 parent c665a43 commit 3bb6d9e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func (c *Controller) Run(ctx context.Context) *info.EgressInfo {
logger.Debugw("waiting for start signal")
select {
case <-c.stopped.Watch():
c.src.Close()
c.Info.SetAborted(info.MsgStartNotReceived)
return c.Info
case <-start:
Expand All @@ -224,17 +225,22 @@ func (c *Controller) Run(ctx context.Context) *info.EgressInfo {
for _, si := range c.sinks {
for _, s := range si {
if err := s.Start(); err != nil {
c.src.Close()
c.Info.SetFailed(err)
return c.Info
}
}
}

if err := c.p.Run(); err != nil {
c.src.Close()
c.Info.SetFailed(err)
return c.Info
}

logger.Debugw("closing source")
c.src.Close()

logger.Debugw("closing sinks")
for _, si := range c.sinks {
for _, s := range si {
Expand Down Expand Up @@ -443,9 +449,6 @@ func (c *Controller) Close() {
c.updateDuration(c.src.GetEndedAt())
}

logger.Debugw("closing source")
c.src.Close()

// update status
if c.Info.Status == livekit.EgressStatus_EGRESS_FAILED {
if o := c.GetStreamConfig(); o != nil {
Expand Down

0 comments on commit 3bb6d9e

Please sign in to comment.