Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multi output use case with image outputs. Fix local image save path #614

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading