Skip to content

Commit

Permalink
Fix multi output use case with image outputs. Fix local image save pa…
Browse files Browse the repository at this point in the history
…th (#614)
  • Loading branch information
biglittlebigben authored Feb 22, 2024
1 parent 1c57bde commit 2b48c8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/config/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
files := req.GetFileOutputs()
streams := req.GetStreamOutputs()
segments := req.GetSegmentOutputs()
images := req.GetImageOutputs()

// file output
var file *livekit.EncodedFileOutput
Expand Down Expand Up @@ -84,7 +85,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
}

p.Info.FileResults = []*livekit.FileInfo{conf.FileInfo}
if len(streams)+len(segments) == 0 {
if len(streams)+len(segments)+len(images) == 0 {
p.Info.Result = &livekit.EgressInfo_File{File: conf.FileInfo}
return nil
}
Expand Down Expand Up @@ -119,7 +120,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
streamInfoList = append(streamInfoList, info)
}
p.Info.StreamResults = streamInfoList
if len(files)+len(segments) == 0 {
if len(files)+len(segments)+len(images) == 0 {
// empty stream output only valid in combination with other outputs
if len(stream.Urls) == 0 {
return errors.ErrInvalidInput("stream url")
Expand Down Expand Up @@ -156,7 +157,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
}

p.Info.SegmentResults = []*livekit.SegmentsInfo{conf.SegmentsInfo}
if len(streams)+len(segments) == 0 {
if len(streams)+len(files)+len(images) == 0 {
p.Info.Result = &livekit.EgressInfo_Segments{Segments: conf.SegmentsInfo}
return nil
}
Expand All @@ -170,7 +171,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
p.KeyFrameInterval = float64(2 * segmentConf[0].(*SegmentConfig).SegmentDuration)
}

err := p.updateImageOutputs(req)
err := p.updateImageOutputs(images)
if err != nil {
return err
}
Expand Down Expand Up @@ -220,8 +221,7 @@ func (p *PipelineConfig) updateDirectOutput(req *livekit.TrackEgressRequest) err
return nil
}

func (p *PipelineConfig) updateImageOutputs(req ImageOutput) error {
images := req.GetImageOutputs()
func (p *PipelineConfig) updateImageOutputs(images []*livekit.ImageOutput) error {

if len(images) > 0 && !p.VideoEnabled {
return errors.ErrInvalidInput("audio_only")
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func BuildImageBin(c *config.ImageConfig, pipeline *gstreamer.Pipeline, p *confi
}

// File will be renamed if the TS prefix is configured
location := fmt.Sprintf("%s_%%05d%s", path.Join(c.StorageDir, c.ImagePrefix), types.FileExtensionForOutputType[c.OutputType])
location := fmt.Sprintf("%s_%%05d%s", path.Join(c.LocalDir, c.ImagePrefix), types.FileExtensionForOutputType[c.OutputType])

err = sink.SetProperty("location", location)
if err != nil {
Expand Down

0 comments on commit 2b48c8a

Please sign in to comment.